Cobertura で単体テストを実行する Ant ビルド スクリプトをセットアップしました。「junit」タスクに「10000」の「タイムアウト」属性があります。
単体テストの実行を何度もテストしました。何らかの理由で、しばらく実行していなかった後に最初に実行すると (朝一番など)、すべてのテスト ケースが次のように失敗することがよくあります。
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.
これが発生するたびに、コマンドラインを再実行するだけですべてが機能します。このように失敗すると、開始する前に少し遅れますが、確かに 10 秒ではありません。
これを防ぐにはどうすればよいですか?これは、コマンド ラインから手動で実行するときに発生することの 1 つですが、これを CI サーバーから実行するように設定すると、まったく別のことが起こります。