简体   繁体   English

TFS 构建通过 REST API 和 PowerShell 发布测试结果 TRX

[英]TFS build publish test results TRX via REST API & PowerShell

I have a TFS build process that incorporates asynchronous remote functional test executions.我有一个包含异步远程功能测试执行的 TFS 构建过程。 When the tests have finished executing, I want to publish the generated TRX file in the originating build summary and update the build status (if required).测试完成执行后,我想在原始构建摘要中发布生成的 TRX 文件并更新构建状态(如果需要)。

I've been searching for awhile now and have so far been unsuccessful in finding exactly what I'm looking for: is it possible to publish the TRX file to the build summary via a PowerShell scripted REST API call?我已经搜索了一段时间,但到目前为止还没有成功找到我正在寻找的内容:是否可以通过 PowerShell 脚本 REST API 调用将 TRX 文件发布到构建摘要?

I am afraid there is not a rest api available to publish the TRX file to the build summary page.恐怕没有可用于将 TRX 文件发布到构建摘要页面的 rest api。

During the pipeline execution, the tasks consume the trx file and read the test result to generate a report which you see on the build summary page.在管道执行期间,任务使用 trx 文件并读取测试结果以生成您在构建摘要页面上看到的报告。 So even if you managed to upload the trx file afterwards, the trx file will not be processed and you cannot get test report on the build summary page.因此,即使您之后设法上传了 trx 文件,也不会处理 trx 文件,您也无法在构建摘要页面上获得测试报告。

If your pipeline waits for the test execution to complete, you can try using scripts to copy the generated TRX file back to the local agent machine and published via publish tesk results task.如果您的管道等待测试执行完成,您可以尝试使用脚本将生成的 TRX 文件复制回本地代理机器并通过发布测试结果任务发布

If the pipeline finished before the test execution completed.如果管道在测试执行完成之前完成。 You can create new pipeline to publish the trx file as workaround.您可以创建新管道以发布 trx 文件作为解决方法。 But this will end up showing the test result in a different pipeline build summary page.但这最终会在不同的管道构建摘要页面中显示测试结果。 If it is acceptable to you, you can copy the trx file back to the local agent machine and trigger the new pipeline via Build Queue rest api.如果您可以接受,您可以将 trx 文件复制回本地代理机器,并通过Build Queue rest api 触发新管道。 You can also consider publishing the trx file to a git repo and add this git repo to the new pipeline as git source.您还可以考虑将 trx 文件发布到 git repo,并将此 git repo 作为 git 源添加到新管道中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM