How can I publish NUnit test results using Jenkins Pipeline? How can I publish NUnit test results using Jenkins Pipeline? jenkins jenkins

How can I publish NUnit test results using Jenkins Pipeline?


I used nunit plugin version 0.21 and was able to publish results using

stage("PublishTestReport"){     nunit testResultsPattern: 'TestResult.xml'     }

(TestResult.xml is at the root of jenkins workspace in this above example)


Investigating the NUnit plugin for Jenkins led me on to this issue, where I found the solution:

step([$class: 'NUnitPublisher', testResultsPattern: 'TestResult.xml', debug: false,                  keepJUnitReports: true, skipJUnitArchiver:false, failIfNoResults: true])

Adding this to the pipeline script worked for me!

However, it seemed the following should also work (but at the present, apparently, it does not): Using the Snippet Generator, select this:

step: General Build StepPublish NUnit test result report

This generates the following in the Pipeline script:

step <object of type hudson.plugins.nunit.NUnitPublisher>

This fails!