Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In TFS, how do I find all Test Cases in a Test Suite with a query (C#)?

With Team Foundation Server, given a WorkItem of type "Test Suite," how can I write a query to select all Test Cases associated to that Test Suite?

like image 478
whoknows Avatar asked Jan 28 '16 16:01

whoknows


People also ask

How do I extract test cases from TFS?

For exporting to Excel, you can choose the Print or Email option from the Export dialog box, then choose Cancel from the Print dialog box. The data for the report is displayed. Select the test cases and associated steps, then you can copy and paste it into a Excel if you want.

How many test cases are there in a test suite?

If each test case represents a piece of a scenario, such as the elements that simulate a completing a transaction, use a test suite. For instance, a test suite might contain four test cases, each with a separate test script: Test case 1: Login.


1 Answers

Unfortunately, there are no work item links created between Test Plans, Suites and Cases. So although they are Work Items, they don't have links. This means that a default query isn't possible.

A work around is tagging all test cases in a suite with the name of the suite. You can then use a query that filters on the work item tags.

You can go even further and automate the creation of tags by using some Web Hooks and Azure Functions (or some other hosted API) magic. This allows you to create a Web Hook that listens for the creation (or updates) to Test Cases. By using some of the code mentioned in the other posts you can retrieve the Test Suite of the Test Case and then use the REST API to add it as a Tag to the Test Case.

like image 88
Wouter de Kort Avatar answered Sep 21 '22 17:09

Wouter de Kort