JUnit test results not aggregated

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

JUnit test results not aggregated

Tarjei Knapstad
We have a project that creates several "testresults.xml" files in JUnit format when built. I've added "trunk/build/**/testresults.xml" under the "Publish JUnit test result report" which seems to work, but when the project is built Jenkins only picks up the first testresults.xml file and seems to ignore the rest. The files in question are generated by Catch (https://github.com/philsquared/Catch). I've tried other globs as well like "**/testresults.xml" and "**/*.xml" but they all give the same result.

The generated XML files look like this:
<testsuites>
  <testsuite errors="0" failures="0" tests="48" hostname="tbd" time="0.173425" timestamp="tbd">
    <testcase classname="xxxxxx" name="xxxxxxxxxx" time="0.000048"/>
    <!-- more testcase tags... -->
    <system-out/>
    <system-err/>
  </testsuite>
</testsuites>

Any ideas?

Regards,
--
Tarjei Knapstad

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: JUnit test results not aggregated

Tarjei Knapstad
To answer my own question, the problem was with the XML files generated by Catch and missing XML attributes. I wrote a post-build shell script that modifies the <testsuite> tag to include the name= and package= attributes base on path manipulation. The classname attribute is also modified to have name= attribute as a prefix (this generates a nicer report in Jenkins to avoid all tests having the "(root)" package name). 

The modified XML looks like this:

<testsuites>
  <testsuite name="apps.someapp" package="apps" errors="0" failures="0" tests="48" hostname="tbd" time="0.173425" timestamp="tbd">
    <testcase classname="apps.someapp.xxxxxx" name="xxxxxxxxxx" time="0.000048"/>
    <!-- more testcase tags... -->
    <system-out/>
    <system-err/>
  </testsuite>
</testsuites>

I've attached the script in case anyone needs it. You may have to adapt the extraction of the NAME and PACKAGE variables to suit your needs.

Regards,
--
Tarjei

On Wednesday, April 23, 2014 3:31:46 PM UTC+2, Tarjei Knapstad wrote:
We have a project that creates several "testresults.xml" files in JUnit format when built. I've added "trunk/build/**/testresults.xml" under the "Publish JUnit test result report" which seems to work, but when the project is built Jenkins only picks up the first testresults.xml file and seems to ignore the rest. The files in question are generated by Catch (<a href="https://github.com/philsquared/Catch" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fphilsquared%2FCatch\46sa\75D\46sntz\0751\46usg\75AFQjCNFkoJ9FZzq2MtyopGvyFAEewI4IHg';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fphilsquared%2FCatch\46sa\75D\46sntz\0751\46usg\75AFQjCNFkoJ9FZzq2MtyopGvyFAEewI4IHg';return true;">https://github.com/philsquared/Catch). I've tried other globs as well like "**/testresults.xml" and "**/*.xml" but they all give the same result.

The generated XML files look like this:
<testsuites>
  <testsuite errors="0" failures="0" tests="48" hostname="tbd" time="0.173425" timestamp="tbd">
    <testcase classname="xxxxxx" name="xxxxxxxxxx" time="0.000048"/>
    <!-- more testcase tags... -->
    <system-out/>
    <system-err/>
  </testsuite>
</testsuites>

Any ideas?

Regards,
--
Tarjei Knapstad

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

fix_testresults.sh (553 bytes) Download Attachment