I have an existing test result and I'd like to update the "Tested build" field for the test result if possible. I've looked at the REST API doc (https://docs.microsoft.com/en-us/rest/api/azure/devops/test/results/update?view=azure-devops-rest-5.0) and I think that I've called the PATCH method correctly but while a 200 is returned, the test result in the UI doesn't change with "not available".
Is there a way to change this field or is it read-only?
PATCH https://dev.azure.com/{org}/{project}/_apis/test/Runs/{runId}/results?api-version=5.0
Auth: PAT for user who has Test Plans license
JSON request body:
[
{
"id": "100000",
"build": {
"id": "206",
"name": {buildDefinitonName},
"url": "https://dev.azure.com/{org}/{projectguid}/_apis/build/Builds/206"
}
}
]
JSON response body:
{
"count": 1,
"value": [
{
"id": 100000,
"project": {},
"lastUpdatedDate": "2019-06-13T17:18:56.073Z",
"priority": 0,
"url": "",
"lastUpdatedBy": {
"displayName": null,
"id": null
}
}
]
}
I've also tried with the .NET SDK but no luck:
...
var build = await buildClient.GetBuildAsync(projectGuid, 206);
var testResult = await testClient.GetTestResultByIdAsync(projectGuid, {runId}, 100000);
testResult.Build = new Microsoft.TeamFoundation.TestManagement.WebApi.ShallowReference
{
Id = build.Id.ToString(),
Name = build.Definition.Name,
Url = build.Url
};
TestCaseResult[] results = new TestCaseResult[] { testResult };
var outcome = await testClient.UpdateTestResultsAsync(results, teamProject, {runId});
(outcome shows Build = null)