Jenkins seems to pass -Dmaven.test.failure.ignore<http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#testFailureIgnore>=true as default. If I set -Dmaven.test.failure.ignore<http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#testFailureIgnore>=false, the build breaks on the failed unit test. I think, this is done to let jenkins finish the build with whatever else needs to be done (collecting data, clean up, ...).
But still I found some strage behaviour in maven projects: - If I use the "Build other projects"-option in "Post-build Actions"-section with "Trigger only if build succeeds" selected, the projects to build are NOT triggered if there were unit test failures. Good. - If I use the same option "Trigger only if build succeeds" for the "Post Steps"-section the configured post steps are still executed, even if there were unit test failures. Bad. Shouldn't the two switches have the same effect? If you agree, I open a bug for this. Regard, Frederik 2012/4/11 Wannes Sels <[email protected]> > Maven reports BUILD SUCCESS even though there are test failures, this is > the reason why your build succeeds. > Maybe you already pass > -Dmaven.test.failure.ignore<http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#testFailureIgnore>=true > as a parameter to the maven calls? You could try adding > help:effective-pom<http://maven.apache.org/plugins/maven-help-plugin/effective-pom-mojo.html>as > a maven call, to see if the property is set. > > -- > Wannes Sels > > > On Wed, Apr 11, 2012 at 11:45, Frederik Fromm < > [email protected]> wrote: > >> Thanks for the quick answer. But perhaps I need to add more detail. In >> the same log I find: >> ... >> [ERROR] There are test failures. >> ... >> [INFO] >> ------------------------------------------------------------------------ >> *[INFO] BUILD SUCCESS* >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] Total time: 3:26.538s >> [INFO] Finished at: Wed Apr 11 10:09:40 CEST 2012 >> [INFO] Final Memory: 37M/90M >> [INFO] >> ------------------------------------------------------------------------ >> Waiting for Jenkins to finish collecting data >> channel stopped >> *Triggering projects: childProject >> *Finished: SUCCESS >> The "*Triggering projects: childProject"* should not be the result, if >> "Run only if build succeeds" is set. >> >> I want that failed unit tests break the build and no child jobs should be >> triggered. >> >> Any more thoughts? >> >> Thanks again, >> >> Frederik Fromm >> >> >> 2012/4/11 Adrien Lecharpentier <[email protected]> >> >>> I don't think this is a bug because if you run the same goals on a dev >>> computer, you will see that with tests failure, maven set the build result >>> to "build failure". >>> >>> You can add an option to maven to prevent it to set the build result to >>> "build failure" : -Dmaven.test.failure.ignore=true. >>> >>> I think this is not a really good idea because a test failure should be >>> a critical point and you process should end when there are tests >>> failure/error as well as when there are compilations errors. >>> >>> -- >>> Adrien Lecharpentier >>> >>> >>> Le 11 avril 2012 11:23, ffromm <[email protected]> a écrit : >>> >>> Hi, >>>> >>>> I have a question about the execution of post build steps in maven >>>> builds with test failures: >>>> >>>> In a maven project there are 3 options to run post steps: >>>> >>>> - Run only if build succeeds >>>> - Run only if build succeeds or is unstable >>>> - Run regardless of build result >>>> >>>> The last one is the default. >>>> >>>> I understand these option that choosing the first one "Run only if >>>> build succeeds" no post steps are executed if the build is unstable. >>>> No shell scripts, no trigger of other builds, etc. Is that right? >>>> >>>> Because, right now, having "Run only if build succeeds" set, I find >>>> "[ERROR] There are test failures." in the build's log an and got a >>>> yellow ball, but still the configured child job gets triggered and >>>> executed using the parameterized trigger plugin. >>>> >>>> Is this intended to be like this or is this a bug? >>>> >>>> Any explication is appreciated. Thanks. >>>> >>>> Frederik Fromm >>> >>> >>> >> >
