tfs-sdk

Not able to add test cases to type of IRequirementTestSuite

不羁的心 提交于 2019-12-11 09:38:29
问题 I have created a test case workitem using TFS API.When i am trying to the test case to IStaticTestSuite it was successfull. if (firstMatchingSuite.TestSuiteType == TestSuiteType.StaticTestSuite) ((IStaticTestSuite)firstMatchingSuite).Entries.Add(testCase); But i am not able to add a test case to IRequirementTestSuite using the below code.I get "Cannot add or remove test cases" error. if (firstMatchingSuite.TestSuiteType == TestSuiteType.RequirementTestSuite) ((IRequirementTestSuite

Issue with TFS VersionControlServer GetWorkspace throwing ItemNotMappedException

邮差的信 提交于 2019-12-11 09:08:06
问题 I have a small chunk of code that constantly fails when I try to get the workspace. var tfs = new TfsTeamProjectCollection(new Uri("https://mytfs.com/projects")); var versionControlServer = tfs.GetService<VersionControlServer>(); var workspace = versionControlServer.GetWorkspace(@"C:\MyProjects\ProjectA\BranchA"); I've verified that it's mapped in TFS (by, ya know, having worked on several branches of ProjectA over a couple years). I also specifically checked the mapping after I received the

Reporting on completed sprint

只谈情不闲聊 提交于 2019-12-11 06:36:20
问题 Want to build a report showing each team member's percentage contribution per a completed Sprint. We break up the work in Tasks and assign a Remaining Work value to indicate the time needed. The problem then is that remaining value is clear or decreased as the sprint progresses. Have been looking for a way to find the original remaining value, so I can use it for reporting post the sprint. All in an effort to try and build a relation between originally set Effort and Actual hours. Any

ITestCaseResult.Iterations.Count returns 0 for a test with iterations

白昼怎懂夜的黑 提交于 2019-12-11 05:52:53
问题 I have a couple of simple web tests that use data sources. Each web test contains only one request. After they run it's pretty hard to detect why they failed, given that they are quite a few (80) and each has a number of rows that varies between 1 and 150. Therefore, I used the TFS SDK to access the results programmatically, after publishing the test results to a build in TFS. Here is the relevant part of the code: foreach (var testRun in testRuns) { Console.WriteLine(string.Format("{0}",

Getting the BuildAgent information from a Build

跟風遠走 提交于 2019-12-11 03:53:47
问题 I have a IBuildDetail variable with the build information I need. Okay, but when I check the property BuildAgent it's showing this: build.BuildAgent' threw an exception of type 'System.NotImplementedException Then I tryed to check build.BuildController.Agents, it's nice I found the BuildAgent, but there are 7 build agents in this collection. I need only the build agent related to my build, not all build agents from that controller. Anyone knows how to get that information? (Select a build

TFS 2010 work item - Work item links

旧巷老猫 提交于 2019-12-11 01:59:18
问题 When a user opens a bug from a test case, I need to check if the test case is linked to a requirement item and if so I need to link the bug to the requirement item. How can I know this information? I use following piece of code: WorkItemLinkCollection links = _workItem.WorkItemLinks; foreach (WorkItemLink link in links) { } but I don't know how to get the link type and link id. 回答1: WorkItemLink is an abstract base class. ExternalLink, HyperLink, and RelatedLink inherit from it so the link

Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions

﹥>﹥吖頭↗ 提交于 2019-12-11 01:46:57
问题 I'm trying to make some way of figuring out who to "blame" when an exception is thrown in our application (at work). It could be me causing it of course but I can accept that :). But to do this I need the history of a file in TFS so I can check who last made a change at the line of the exception. Its of course not always at the row of the exception that the erroneous change was inserted, so I would probably also need to check any changes to the same file and lastly any check-ins made very

Complete TFS Pull Request programmatically

元气小坏坏 提交于 2019-12-11 01:27:42
问题 Using the Microsoft.TeamFoundationServer.Client (15.112.1) to connect to a TFS 2017 Update 2 server we can get details about an existing PR like this: var connection = new VssConnection(collectionUri, credentials); var client = connection.GetClient<GitHttpClient>(); var pr = await client.GetPullRequestByIdAsync(pullRequestId); Also, we can create new PR like this: var pr = await client.CreatePullRequestAsync( new GitPullRequest { SourceRefName = "master", TargetRefName = "develop", Title = "

Querying failed unit tests from TFS-SDK?

混江龙づ霸主 提交于 2019-12-10 21:23:03
问题 Given a TFS build detail (IBuildDetail) with .Status of PartialSuccess , and .TestStatus of Failed how might I go about retrieving the list of tests (MSTest) that have failed on that build? I have a working sandbox in which I can contact TFS via the SDK and retrieve the latest PartialSuccess build, but can't seem to find which service might have this unit test data and how I might go about querying it. Can anyone shed some light? 回答1: This article is a great resource, actually it was the only

TF30063: You are not authorized … programmatic access not working

喜你入骨 提交于 2019-12-10 18:40:01
问题 The code below provided in this answer did work well for a while but now its throwing Microsoft.TeamFoundation.TeamFoundationServerUnauthorizedException: 'TF30063: You are not authorized to access https://{mysite}.visualstudio.com/.' again. var credentials = new VssClientCredentials(); credentials.PromptType = CredentialPromptType.PromptIfNeeded; var teamProjects = new TfsTeamProjectCollection(tfsCollectionUri, credentials); teamProjects.EnsureAuthenticated(); // exception thrown Q How can I