“如何使用 TFS 2018 API 从特定版本获取测试运行 ID"
我们的发布管道中有一个运行 Seleniumtests(Visual Studio 测试任务)的任务.selenium 测试运行,我们可以在运行后手动向测试运行添加附件.我们还设法添加了带有 api 的附件,但我们没有一个很好的方法来提取上传所需的 testrunid.
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.
我们如何以一种好的方式从发布中获取测试运行 ID,以便我们可以将附件绑定到正确的测试运行.我们只设法使用 api 进行所有测试运行,这很多.
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.
您可以从特定版本的测试日志中查看测试运行 ID.
You can see test run id from the test log for a specific release.
因此,最简单的方法是使用 REST API 从日志中获取特定的测试运行 ID.
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}
参见获取任务日志 了解详情.
编辑 获取任务日志 v5