0

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.

David M. Karr
  • 14,317
  • 20
  • 94
  • 199
  • What are the tests doing? "First thing in the morning" sounds like some sort of caching. For example repeatedly running the same SQL query against databases like Oracle often triggers internal memory caching of the data, delivering an improvement in query performance. – Mark O'Connor Nov 13 '12 at 18:11
  • These are pure unit tests. They don't connect to a database or any external service. – David M. Karr Nov 13 '12 at 18:47
  • Odd, perhaps someone else has ideas. – Mark O'Connor Nov 13 '12 at 18:54

1 Answers1

0

I guess I'm going to call this moot. Part of the problem is that Cobertura is currently printing tons of debug output, which I guess is causing the problem. It helped when I added 'forkmode="once"'. They're working on adding a "quiet mode" to Cobertura that will help further.

David M. Karr
  • 14,317
  • 20
  • 94
  • 199