如何在不运行数据的情况下从VSTS中的测试套件中获取所有测试用例

时间:2018-07-17 17:38:04

标签: rest azure-devops

我正在尝试从VSTS中的测试套件中获取所有测试用例,甚至是没有运行数据的测试用例(标记为“活动”)。我知道如何获取案例ID,但不知道名称/标题。现在,它会遍历运行数据和结果,并从结果中获取所有信息,但是如果没有运行数据,它将无法正常工作。

我正在使用C#使用RestSharp for RestRequests。这是我的RestRequests之一:/_apis/test/runs?planId=" + planID.ToString() + "&includeRunDetails=true&api-version=5.0-preview.2可以获取运行数据测试用例所需的所有信息。我一直在使用VSTS API上的Microsoft文档寻求帮助:https://docs.microsoft.com/en-us/rest/api/vsts/?view=vsts-rest-5.0

从套件中获取测试用例是理想的选择,但我会接受任何可行的方法。

1 个答案:

答案 0 :(得分:1)

您可以结合使用Get all test cases in a suite API和Returns a list of work items API。首先,从下面的api获取测试用例ID:

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

然后,通过以下api获取有关测试用例的更多信息:

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