-
Bug
-
Resolution: Incomplete
-
Major
-
None
The junit extention point TestDataPublisher does not work when used with the maven-plugin and its implementation MavenTestDataPublisher. There are two (unrelated) issues:
- MavenTestDataPublisher does not work with maven modules, and even a single pom maven module will be handled as an aggregated build of that module. The problem is that (a) the top module does not contain a SurfireReport (b) the publisher will not understand that it should try to fetch a SurefireReport from each sub module. Here's a way to do it that works (for me): https://github.com/pra/testcasedecorator/blob/master/src/main/java/com/polopoly/jenkins/MavenTestDataPublisherFix.java (borrowed from http://code.google.com/p/hudson-junit-html-links-enricher/source/browse/src/main/java/org/detailsmatter/hudson/MavenTestDataPublisherFix.java).
- The actions added by the MavenTestDataPublisher to TestResultAction is not saved with the build.xml and therefore any annotations are lost when accessing the test report at a later stage. Looking into the MavenModuleSetBuild.post2 reveals the problem:
// asynchronous executions from the build might have left some unsaved state, // so just to be safe, save them all. for (MavenBuild b : getModuleLastBuilds().values()) b.save(); // at this point the result is all set, so ignore the return value if (!performAllBuildSteps(listener, project.getPublishers(), true)) setResult(FAILURE);
The problem is that the extentsion point where you can annotate the test result is run after the last save of the project. Adding a save to MavenTestDataPublisher (see above example fix at github) solves the problem. To me the build.xml looks this way when adding the save() call:
<testData> <com.polopoly.jenkins.KnownBugAnnotator_-KnownBugData> <build class="hudson.maven.MavenBuild" reference="../../../../.."/> </com.polopoly.jenkins.KnownBugAnnotator_-KnownBugData> <hudson.plugins.claim.ClaimTestDataPublisher_-Data> <claims/> <build class="hudson.maven.MavenBuild" reference="../../../../.."/> </hudson.plugins.claim.ClaimTestDataPublisher_-Data> </testData>