Reputation: 57162
Is there a way to cause hudson to report a build as failed, rather than unstable, if only a single unit test fails? thanks.
Upvotes: 5
Views: 8505
Reputation: 21186
It's actually not a good idea to fail the build if tests failed when using hudson. Problem is hudson will not report the state of test pass/fail if the build fails. If the build fails, hudson deems it to not have completed properly and thus does not act on the result.
Upvotes: 3
Reputation: 57162
Hudson actually enables the ignoring of test failures. It just needs to be put as a property in hudson. -Dmaven.test.failure.ignore=false
Upvotes: 13
Reputation: 54605
There are two properties to the junit task
errorProperty="maven.test.error"
failureProperty="maven.test.failure"
After the junit tag you should be able to do something like this
<fail message="Test failed!!!" if="maven.test.error" />
<fail message="Test failed!!!" if="maven.test.failure" />
But don't nail me on this
Upvotes: 2
Reputation: 590
Look through your job configuration, I believe there is a property (check box) that says fail on test failure, or something of the sort. We use this on some of our projects at my work.
Otherwise if you want to use the Ant method as suggested maven can run ant tasks...
Upvotes: 0
Reputation: 308733
If you're using Ant to drive the build, you can configure the JUnit task to halt on failure. Is that what you mean?
Upvotes: 0