“How to get test run id from a specific release using TFS 2018 API”

我与影子孤独终老i 提交于 2019-12-08 07:14:56

问题


We have a task in our release pipeline that runs Seleniumtests(Visual studio test task). The selenium tests run and we can after the run add an attachment to the testrun manually. We also manage to add an attachment with the api but we don't have a good way to extract the testrunid that is necessary for the upload.

How do we in a good way get the test run id from a release so we can bind the attachment to the right testrun. We only manage to get all test runs with the api, which is alot.

Where we want the attachment to be uploaded with the api


回答1:


You can see test run id from the test log for a specific release.

So, the simplest way is getting the specific test run id with the REST API from the log.

GET https://{instance}/{project}/_apis/release/releases/{releaseId}/environments/{environmentId}/deployPhases/{releaseDeployPhaseId}/tasks/{taskId}/logs?api-version={version}

See Get task log for details.

EDIT Get Task Log v5




回答2:


I am using the following API to get test results for the release,
GET https://{instance}/{project}/_apis/ResultDetailsByRelease?releaseId={RELEASE.RELEASEID}&releaseEnvId={RELEASE.ENVIRONMENTURID}

The test results included testRun ID or get failed tests only by using filter,
GET https://{instance}/{project}/_apis/ResultDetailsByRelease?releaseId={RELEASE.RELEASEID}&releaseEnvId=RELEASE.ENVIRONMENTURID}&%24filter=Outcome+eq+Failed



来源:https://stackoverflow.com/questions/47415429/how-to-get-test-run-id-from-a-specific-release-using-tfs-2018-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!