[英]AzureDevops PowerShell and Tasks
I currently have a VSTS/AzureDevOps task extension which is composed of a json
file and a ps1
script. 我目前有一个VSTS / AzureDevOps任务扩展,它由一个
json
文件和一个ps1
脚本组成。 The json
file basically stipulates the inputs and the ps1
script does it's thing (it runs some tests.) I want to extend this task to upload test results in the pipeline, and AzureDevops has the handy "Publish Test Results", but thats a YAML
thing. json
文件基本上规定了输入,而ps1
脚本确实实现了它(它运行一些测试。)我想扩展此任务以在管道中上传测试结果,AzureDevops具有方便的“发布测试结果”,但这就是YAML
事情。
Is there any way to get the same functionality as using the premade task, but just via PowerShell? 有什么方法可以通过使用PowerShell获得与使用预制任务相同的功能吗? I looked at things like this but I could not find something obvious.
我看着东西像这样 ,但我无法找到明显。
I assume the only other route for doing this would be somehow using the AzureDevops REST api? 我认为执行此操作的唯一其他方法是使用AzureDevops REST API?
I tested artifact.upload
following the example given here . 我按照此处给出的示例测试了
artifact.upload
。 and found out it published the file to the artifacts, and can not show the test result in the Tests
page of build Summary
as shown in below pic. 并发现将文件发布到工件,并且无法在构建
Summary
的“ Tests
页面中显示测试结果,如下图所示。
Tested with artifact.upload
with below script in powershell. 使用powershell中的以下脚本对
artifact.upload
进行了测试。
echo "##vso[artifact.upload containerfolder=testresult;artifactname=uploadedresult;]$(Agent.BuildDirectory)\TestResult\WS-LEVIL-01_WS-LEVIL-01_2019-09-05_11_36_44.trx"
the task log showed as below: 任务日志显示如下:
Uploading 1 files
File upload succeed.
Upload 'C:\agent\_work\2\TestResult\WS-LEVIL-01_WS-LEVIL-01_2019-09-05_11_36_44.trx' to file container: '#/3389084/testresult'
Associated artifact 209 with build 595
Async Command End: Upload Artifact
I tried to do this with pure powershell and seemed be a hard work. 我尝试使用纯Powershell做到这一点,似乎是一项艰巨的工作。 If you only want to publish it to azure pipeline and want to show the results like above pic.
如果您只想将其发布到azure管道,并想要显示如上图所示的结果。 You can save the xml file to a place on the host agent and then use
Publish Test Result
task to pulish the xml test result. 您可以将xml文件保存到主机代理上的某个位置,然后使用“
Publish Test Result
任务来执行xml测试结果。 This seems like a easier workaround. 这似乎是一个更简单的解决方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.