none
How can I link a test case as a “tested user story” with the Microsoft.TeamFoundation API?

    Pertanyaan

  • I'm writing a console application in C# using the Microsoft.TeamFoundation classes to connect to a Visual Studio Team Foundation Server 2015 on-premises instance.

    My application needs to create/upload test cases and link them to existing user stories. If I use the RelatedLink class and add it to the ITestCase.Links property, when I view the test case through the web portal, the links appear under the All Links tab, and not the Tested User Stories tab.

    How can I go about linking test cases and stories so that they appear in the Tested User Stories tab instead?

    Kamis, 02 Agustus 2018 01.49

Semua Balasan

  • Hi,

    You might be not using correct link types.

    Please try below line of code - 

    workItemStore = (WorkItemStore)teamProjectCollection.GetService(typeof(WorkItemStore));
    WorkItem sourceWt = workItemStore.GetWorkItem(ID);
    
    WorkItemLinkType linkType = workItemStore.WorkItemLinkTypes["Microsoft.VSTS.Common.TestedBy"];
                    WorkItemLinkTypeEnd linkTypeEnd = workItemStore.WorkItemLinkTypes.LinkTypeEnds[linkType.ForwardEnd.Name];
    
    sourceWt.Links.Add(new RelatedLink(linkTypeEnd,userStoryID ));
                       


    Thanks,
    Vivek Bansod
    Blog | MSDN | LinkedIn
     

    Jumat, 03 Agustus 2018 08.01