Maven2 junit超时注释不起作用
我们在 Maven2 项目中进行了大量测试,并使用 CruiseControl 进行构建。然而,构建经常挂起,因为带有超时的测试注释
@Test(timeout = 5000)
被忽略。 我尝试在本地运行maven,重现超时被忽略的事实。
有没有办法再次激活测试超时?
我目前使用一种解决方法在巡航控制中设置超时。然而,这仅仅意味着整个构建被取消,而不仅仅是应该失败的测试。
评论: 似乎在 Maven 1 中有一个属性可以激活 junit 超时,而在 Maven 2 中却缺少该属性。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试设置
forkedProcessTimeoutInSeconds
Maven Surefire 插件 的 参数:这似乎相当于
maven.junit.timeout
test property 在 Maven 1 中,并将在 Maven 级别“激活”超时(与注释不同)。Try to set the
forkedProcessTimeoutInSeconds
parameter of the Maven Surefire Plugin: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).