Sam
Sam

Reputation: 13

How to get all test cases from test suite in VSTS without run data

I'm trying to get all the test cases from a test suite in VSTS, even test cases that have no run data, marked as "Active." I know how to get the case ID, but not the name/title. Right now it goes through the run data and results and gets all the information from the result, but it won't work if there is no run data.

I'm working in C# using RestSharp for RestRequests. This is one of my RestRequests: /_apis/test/runs?planId=" + planID.ToString() + "&includeRunDetails=true&api-version=5.0-preview.2 This works to get all the information I need for test cases with run data. I have been using Microsoft docs on VSTS API for help: https://learn.microsoft.com/en-us/rest/api/vsts/?view=vsts-rest-5.0

Getting the test cases from the suite would be ideal, but I'll accept anything that works.

Upvotes: 0

Views: 1089

Answers (1)

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31023

You can combine Get all test cases in a suite api and Returns a list of work items api. First, get the test case ids from the api below:

GET https://{accountName}.visualstudio.com/{project}/_apis/test/Plans/{planId}/suites/{suiteId}/testcases?api-version=5.0-preview.3

Then, get more information of the test cases from the following api:

GET https://{accountName}.visualstudio.com/{project}/_apis/wit/workitems?ids={ids}&api-version=5.0-preview.3

Upvotes: 1

Related Questions