简体   繁体   English

是否可以在 Jenkins 测试作业中下载原始 xml 文件

[英]Is it possible to download the raw xml file in a Jenkins test job

On a Jenkins job is there a way to download the raw xml file produced by the tests?在 Jenkins 作业上,有没有办法下载测试生成的原始 xml 文件? eg Via an extended url, etc?例如,通过扩展的 url 等?

The nominal way is to archive the xml file.名义上的方法是归档 xml 文件。

archiveArtifacts artifacts: 'test-results.xml'
junit 'test-results.xml'

But I figure that Jenkins already has this info in order to create the test failure UI.但我认为 Jenkins 已经拥有此信息,以便创建测试失败 UI。 I'd rather not archive the xml if there's another work around.如果还有其他解决方法,我宁愿不归档 xml。

You can fetch the raw XML by doing this -您可以通过以下方式获取原始 XML -

Say if you want to see for the last completed build说如果您想查看最后完成的构建

<Jenkins URL>/job/<Job Name>/lastCompletedBuild/testReport/api/xml

or if you want for a specific build number或者如果您想要特定的内部版本号

<Jenkins URL>/job/<Job Name>/<Build number>/testReport/api/xml

Archive them.归档它们。

Files in the workspace are not meant to live forever.工作区中的文件并不意味着永远存在。 Archived files are meant to be stored as long as you keep the build logs.只要您保留构建日志,就应该存储归档文件。

Also if you have a permission model active, you can manage the permissions for the archive separately.此外,如果您拥有激活的 model 权限,您可以单独管理存档的权限。 And you can then use variables in the URL like lastSuccessfulBuild to refer to the last successful build.然后,您可以使用 URL 中的变量(如lastSuccessfulBuild来引用上次成功构建。

And lastly: you can use the HTML Publisher as an alternative.最后:您可以使用HTML Publisher作为替代。

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

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