Junit 和 jenkins org.junit.contrib.java.lang.system.internal.CheckExitCalled:试图以状态 0 退出

Junit and jenkins org.junit.contrib.java.lang.system.internal.CheckExitCalled: Tried to exit with status 0

我尝试运行 并行进行 junit 测试。但是,虽然我的测试必须完成,但他们没有。 我的詹金斯 运行ning 似乎不会结束。

The error is:
org.junit.contrib.java.lang.system.internal.CheckExitCalled: Tried to exit with status 0.
    at org.junit.contrib.java.lang.system.internal.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:24)
    at java.lang.Runtime.exit(Runtime.java:107)
    at java.lang.System.exit(System.java:962)
    at org.apache.maven.surefire.booter.ForkedBooter.exit(ForkedBooter.java:144)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:127)
Exception in thread "main" org.junit.contrib.java.lang.system.internal.CheckExitCalled: Tried to exit with status 1.
    at org.junit.contrib.java.lang.system.internal.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:24)
    at java.lang.Runtime.exit(Runtime.java:107)
    at java.lang.System.exit(System.java:962)
    at org.apache.maven.surefire.booter.ForkedBooter.exit(ForkedBooter.java:144)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:135)
Exception in thread "Thread-5" Exception in thread "Thread-6" org.junit.contrib.java.lang.system.internal.CheckExitCalled: Tried to exit with status 1.
    at org.junit.contrib.java.lang.system.internal.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:24)
    at java.lang.Runtime.halt(Runtime.java:273)
    at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:176)
    at java.lang.Thread.run(Thread.java:744)
org.junit.contrib.java.lang.system.internal.CheckExitCalled: Tried to exit with status 0.
    at org.junit.contrib.java.lang.system.internal.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:24)
    at java.lang.Runtime.halt(Runtime.java:273)
    at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:176)
    at java.lang.Thread.run(Thread.java:744)

在我的 class 我有:

@Rule
public final ExpectedSystemExit expectedSystemExit = ExpectedSystemExit.none();

 if(carInsuranceSteps.isCheackReservationAddressNotFoundError()) {
            Thucydides.takeScreenshot();
            expectedSystemExit.expectSystemExitWithStatus(0);
            System.exit(0);
        }

System Rules 抛出异常。它必须替换 SecurityManager 才能测试 System.exit(),然后恢复原来的 SecurityManager。这意味着您不能 运行 在同一个 JVM 中并行使用系统规则进行多项测试。