Reputation: 165
Test point not found error while adding test results to a test run
I want to update the status of test cases in Microsoft Test Manager/VSTS using APi.
Following API is used to update the test results:
POST https://{instance}/DefaultCollection/{project}/_apis/test/runs/{run}/results?api-version={version}
Content-Type: application/json
JSON
{
"testCaseTitle": { string },
"testCase": {
"id": { int }
},
"configuration": {
"id": { int },
"name": {string }
},
"testPoint": {
"id": { int }
},
"state": {
enum { Pending, Queued, InProgress, Paused, Completed }
},
"computerName": { string },
"resolutionState": { string },
"priority": { int },
"failureType": { string },
"automatedTestName": { string },
"automatedTestStorage": { string },
"automatedTestType": { string },
"automatedTestId": { string },
"area": {
"name": {string}
},
"owner": {
"DisplayName": {string}
},
"runBy": {
"DisplayName": {string}
},
"outcome": {
enum { None, Passed, Failed, Inconclusive, Timeout, Aborted, Blocked, NotExecuted, Warning, Error, NotApplicable, Paused, InProgress}
},
"errorMessage": { string },
"comment": { string },
"startedDate": { DateTime },
"completedDate": { DateTime },
"durationInMs": { long },
"associatedBugs": [
{
{ "id" : {int} }
}
]
}
For details refer: https://learn.microsoft.com/en-us/vsts/integrate/previous-apis/test/results?view=vsts#add-test-results-to-a-test-run
I created sample requests and checked the response (using Postman).
Request:
[
{
"testCase": {
"id": 5000
},
"outcome": "Passed"
}
]
Response:
404 Not Found
"message": "Test point 0 not found.",
Then somehere I read testPoint = no of configurations. As my test case have one configuration, Operating system = Window 10; I set testPoint = 1.
(using Postman) Request:
[
{
"testCase": {
"id": 5000
},
"priority": 2,
"configuration": {
"id": 14,
"name": "Windows 10"
},
"testPoint": {
"id": 1
},
"outcome": "Passed"
}
]
Response:
404 Not Found
"message": "Test point 1 not found.",
So I want to know what exactly is this testPoint and how to find it for a test case? I want to call this API programatically from java code (for automation testing)? Is it possible?
Upvotes: 1
Views: 2034
Reputation: 165
Actually there is an API to get testPoints,for details refer: https://learn.microsoft.com/en-us/vsts/integrate/previous-apis/test/points?view=vsts#get-a-list-of-test-points
Upvotes: 0
Reputation: 33728
You need to specify the testpoint ID directly, for example:
[
{
"testPoint":{
"id":144
},
"priority": 1,
"outcome": "failed"
}
]
You can get test point's id by using this REST API: Get a test result
Upvotes: 1
Reputation: 31093
The source you refer to is adding a test result to a test run, not updating test results in a test run. You should refer to Update test results for a test run:
PATCH https://{account}.visualstudio.com/{teamproject}/_apis/test/runs/{run}/results?api-version=3.0-preview
Content-Type: application/json
[
{
"id": { int },
"state": {
enum { Pending, Queued, InProgress, Paused, Completed }
},
"computerName": { string },
"resolutionState": { string },
"priority": { int },
"failureType": { string },
"owner": {
"DisplayName": {string}
},
"runBy": {
"DisplayName": {string}
},
"outcome": {
enum { None, Passed, Failed, Inconclusive, Timeout, Aborted, Blocked, NotExecuted, Warning, Error, NotApplicable, Paused, InProgress}
},
"errorMessage": { string },
"comment": { string },
"startedDate": { DateTime },
"completedDate": { DateTime },
"durationInMs": { long },
"associatedBugs": [
{
{ "id" : {int} }
}
]
}
]
You could get the list of the test results for a test run first, and then capture the test result you want to update to the Update API, and modify the values there.
https://{account}.visualstudio.com/{teamproject}/_apis/test/runs/{run}/results?api-version=3.0-preview
Upvotes: 0