I have schedule regression automation that is running everyday from TFS, I want to develop functionality to run only failed test case against latest build not whole regression automation again.
Is there a way, I can only call web api and pass only failed test case name and when I trigger deploy to any environment that will only run
Or is there any other way around this.
There is already a Rerun failed tests
option in the v2.* of the VSTest task in the build definition, you could select this option to rerun the failed tests:
If you want to use api, you would need to follow the steps below:
GET https://{accountName}.visualstudio.com/{project}/_apis/test/Runs/{runId}/results?api-version=5.0-preview.5
POST https://{accountName}.visualstudio.com/{project}/_apis/test/Plans/{planId}/suites/{suiteId}?api-version=5.0-preview.3
Content-Type:application/json
{ "suiteType": "DynamicTestSuite", "name": "FailedTestCases", "queryString": "SELECT [System.Id],[System.WorkItemType],[System.Title],[Microsoft.VSTS.Common.Priority],[System.AssignedTo],[System.AreaPath] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.WorkItemType] IN GROUP 'Microsoft.TestCaseCategory' AND ( [System.Id] = xxx OR [System.Id] = xxx )" }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.