We have a bunch of tests in a maven2 project and build with cruisecontrol. However the build regularly hangs, because the annotation of the test with a timeout
@Test(timeout = 5000)
is ignored. I tried and run maven locally, reproducing the fact that the timeout is ignored.
Is there a way to activate the timeout for the tests 开发者_如何学运维again?
I currently use a workaround in setting a timeout in cruisecontrol. However this simply means that the whole build is canceled, and not just the tests that should fail.
Remark: It seems in maven 1 there was a property to activate the junit timeout which is missing in maven 2.
Try to set the forkedProcessTimeoutInSeconds
parameter of the Maven Surefire Plugin:
Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never timing out
This seems to be an equivalent of the maven.junit.timeout
test property in Maven 1 and will "activate" a timeout at the Maven level (different from the annotation).
精彩评论