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

Viewed 786

On a Jenkins job is there a way to download the raw xml file produced by the tests? e.g. Via an extended url, etc?

The nominal way is to archive the xml file.

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. I'd rather not archive the xml if there's another work around.

2 Answers

You can fetch the raw XML by doing this -

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. And you can then use variables in the URL like lastSuccessfulBuild to refer to the last successful build.

And lastly: you can use the HTML Publisher as an alternative.

Related