Maven message plugins fail if unit test fails

None of the plugins in the Maven report section run if unit test fails.

I found that I can set maven.test.failure.ignore = true here - http://jira.codehaus.org/browse/SUREFIRE-247 The problem with this approach is now that our hudson builds are successful, even if there are unit test errors.

I would really like the maven-surefire-report-plugin plugin for reports to run with build plugins in phase, but I can't get this to work.

Any idea on how to get Maven report plugins to execute if unit test fails?

+4
source share
5 answers

First, run: mvn test OR mvn install Then, if the tests fail, run the following goal to create reports for the test results performed above: mvn -Dmaven.test.skip = true surefire-report: report

+2
source

In the link provided:

With the latest version (2.1.2), I get a message saying: "There are some test errors," but I do not get any reports wherever I specify a variable, or I specify "testFailureIgnore" in the configuration plugin. I received reports from 2.0, but not from 2.1.2.

Do you need version 2.1 or can you work with version 2.0 of Maven?

+1
source

The error you see in 2.1.2 is related to the forkmode settings that need to be done in the plugin.

set forkmode = never and try (I suspect there may be a problem with your use of the Systemclassloader property).

Otherwise, use the plugin version of maven-surefire version 2.5, which should definitely work and generate reliable rpeorts, even if several tests fail.

+1
source

Please use the surefire-report: report-only plugin if reports are already generated after execution.

+1
source

I had the same problem, and due to an incorrect call to the report plugin.

Correct execution of the maven command: mvn surefire-report: report

This will start the test phase on its own, and if it fails, it will still generate a report.

Check the documentation: http://maven.apache.org/surefire/maven-surefire-report-plugin/report-mojo.html

Hope this helps !: D

0
source

All Articles