I am running some test in a containerize environment in Azure and I want to publish those test results in Azure Devops related to its release.
The idea is that the testcases are running in a Release Pipeline, and the container it self when its finished it will publish the test and display them in the tests section of Azure Devops.
I have managed to do this with mounted volumes on the container and with the Publish test task in the pipeline. But the tests takes around 1h and during that time its taking one pipeline agent in Azure.
I have been looking into Azure Devops API and managed to create a new testrun and add test to it through the API. I have related the testrun to the release by its ID https://docs.microsoft.com/en-us/rest/api/azure/devops/test/runs/create?view=azure-devops-rest-5.0. And afterwards added the completed tests results into the test run. However is not displayed on the releases tests.
Any one faced this issue?
Updated end rest API.
Here I obtain the release ID (I expect I will be able to get this release ID during the release pipeline)
curl --location --request GET 'https://vsrm.dev.azure.com/{organization}/NF Development/_apis/release/releases?api-version=6.0'
I create a test run related with this release
curl --location --request POST 'https://dev.azure.com/{organizationname}/NF Development/_apis/test/runs?api-version=5.0' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Testcafe new",
"ReleaseReference": { "id": "1276" },
"isAutomated": true,
"state": "Waiting"
}'
I add test to the test run I obtain in the container.
curl --location --request POST 'https://dev.azure.com/{organizationname}/NF Development/_apis/test/Runs/1004040/results?api-version=6.0' \
--header 'Content-Type: application/json' \
--data-raw '[{
"testCaseTitle": "Testing Tescafe through Azure API",
"automatedTestName": "Patrick Test",
"priority": 1,
"outcome": "Passed"
}
]'
It this point I can see the test run in the in the test plants, however the tests section inside the release it empty.
----------------------- EDIT ----------------------
Maybe my request was not clear. What I want to achieve is what the publish result is doing through the release pipeline, but using AzureDevops pipeline.
Here for example I have this task running, and I can click on the test tab for the release environment and identify all the test from my build. Even that I create a TestRun as described below I cant see this happening.
releaseReference
? – Jane Ma-MSFT