Is there a way to cause hudson to report a build as failed, rather than unstable, if only a single unit test fails? thanks.
If you're using Ant to drive the build, you can configure the JUnit task to halt on failure. Is that what you mean?
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...
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
Hudson actually enables the ignoring of test failures. It just needs to be put as a property in hudson. -Dmaven.test.failure.ignore=false
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.