I've set up an Ant build script to run unit tests with Cobertura. I have a "timeout" attribute of "10000" in the "junit" task.
I've tested running my unit tests many times. For some reason, when I first run it after having not run it for a while (like first thing in the morning), I often see every single test case fail like this:
Testsuite: ...
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
Testcase: null took 0.109 sec
Caused an ERROR
Timeout occurred. Please note the time in the report does not reflect the time until the timeout.
junit.framework.AssertionFailedError: Timeout occurred. Please note the time in the report does not reflect the time until the timeout.
Every time this has happened, I just rerun the command line and everything works. When it fails like this, it does delay a tiny bit before starting, but it's certainly not 10 seconds.
What can I do to prevent this from happening? It's one thing to happen when I run it manually from the command line, but it will be quite another when I have this set up to run from a CI server, where irrelevant failures will be much more annoying.