Jenkins Not Outputting Junit Report Info From File

jenkins, karma-runner

Solution

Finally had the time to figure it out, thanks to amey and Wouter's input.

The key is that I'm building a maven project, and that won't work with displaying the karma tests. The only way to display karma results is to add a post build report for Junit tests. For some reason, maven-based jobs do not give you the option to add a junit report.

The solution is to create a free form job instead of a maven job. You can configure the free form job to build the maven project just fine. As long as you add the publish junit task per amey's post above, all is well.

Problem

Problem A junit-formatted report is not being picked up by Jenkins, causing the reports not to be listed in the project's status screen. Details The junit-formatted report data is generated by a testing framework called Karma-runner (formerly Testacular). The file being ignored is created in `/target/surefire-reports` -- the same location as where surefire-generated reports are created. The report data looks practically the same as that generated by the maven surefire plugin except that its parent element is `<testsuites>` instead of `<testsuite>` -- `<testsuite>` is what the surefire generated reports have as the parent element of a report file. Here's a snippet from the karma-generated junit-formatted report, named `TEST-karma.resultsTest.xml`: Junit-formatted Karma-generated report file, `TEST-karma.resultsTest.xml` ``` <?xml version="1.0"?> <testsuites> <testsuite name="PhantomJS 1.9 (Mac)" package="karma.tests" timestamp="2013-04-10T13:32:26" id="0" hostname="jgmbp.local" tests="16" errors="0" failures="0" time="0.069"> <properties> <property name="browser.fullName" value="Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.0 Safari/534.34"/> </properties> <testcase name="successfully cancels a new member" time="0.006" classname="karma.tests PhantomJS 1.9 (Mac).Household Controller"/> <testcase name="should parse an existing re-eval create date, setting the data in scope" time="0.003" classname="karma.tests PhantomJS 1.9 (Mac).Re-Eval Controller"/> <system-out><![CDATA[ ]]></system-out> <system-err/> </testsuite> </testsuites> ``` The Karma tests are run during the test phase of my maven build. I've tried creating projects that only produce this one junit-report file as well as running the build so that all junit tests and karma tests generate report files. Jenkins will always pick up the surefire tests, but never the karma tests. Thanks for any input!

Original source