You can update the last test result
for a sepcific test case, then the outcome
will reflect on the test case.
- Get the last test run ID first. (User the REST API - Get a list of
test runs)
Use the REST API to update the specific test result.
PATCH https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?api-version=5.0-preview.5
Request Body
[
{
"id": 100000,
"state": "Completed",
"outcome": "Passed"
}
]
Please see Update test results for a test run for details.
You can reference this similar thread : Changing the outcome field of testcases within a test suite in Tfs
UPDATE:
If you just want to mark a test case to Passed
or Failed
and generate a RUNID, then you can use below REST API: (Provide the PlanID, suite ID and test point ID in the request body)
POST http://SERVER:8080/tfs/DefaultCollection/{ProjectName or ID}/_api/_testManagement/BulkMarkTestPoints
Content-Type : application/json
Request Body:
{"planId":36,"suiteId":38,"testPointIds":[5],"outcome":3}
- You can get the
Plan Id
, Suite Id
from web portal (Reference
below screenshot)
You can use below REST API to get the testPointIds
:
GET http://SERVER:8080/tfs/DefaultCollection/{ProjectName or ID}/_apis/test/Plans/36/Suites/38/points
- For
outcome
: 2
means Passed
, 3
means Failed
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…