Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Workflow and NUnit Test Results

I'm currently using Jenkins Workflow with a project that is producing NUnit test results.

I've tried using a simple build step to archive these test results

step([$class: "JUnitResultArchiver", artifacts: "Test-Results/**/*.*"])

Unfortunately it seems the JUnit archiver is unable to parse the XML produced by nunit-console, it outputs that the file contains no results. I'm guessing this is because there are differences between JUnit and NUnit in terms of the XML schema (I probably should have realized this).

The Jenkins NUnit plugin is able to parse the file but it seems the plugin isn't yet implementing the simple build step required for it to be used with Workflow.

Has anyone found a way to get this working or do we have to wait for the NUnit plugin to be made Workflow friendly?

like image 680
user3617723 Avatar asked Oct 15 '25 21:10

user3617723


2 Answers

Transform the the nunit result file "TestResult.xml", using the below command.

bat '"h:\\tools\\msxsl.exe" "TestResult.xml" "nunit-to-junit.xsl" -o JUnitLikeNunitResults.xml'

you can download the "msxsl.exe" from the MS site, for the "nunit-to-junit.xsl" you can grab it from the nunit test publishing plugin for jenkins source code.

Once this is done, use the step to publish step([$class: 'JUnitResultArchiver', allowEmptyResults: true, testResults: 'JUnitLikeNunitResults.xml'])

like image 163
OK999 Avatar answered Oct 18 '25 16:10

OK999


I used nunit3-xunit transform in generation of my unit test report and then was able to use junit publish step in pipeline plug in.

like image 44
aobrazcova Avatar answered Oct 18 '25 14:10

aobrazcova



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!