maven - fail build when unit test takes too long

后端 未结 6 2111
广开言路
广开言路 2021-02-12 20:22

I have in my project a lot of unit tests, written in JUnit and TestNG. The building process is based on maven with surefire plugin.

Is there any way/plugin for maven to

6条回答
  •  清酒与你
    2021-02-12 21:08

    Why don't add a timeout on a per test basis. I assume you're programming in Java, so in JUnit you can do something like this:

     @Test(timeout=100) public void testQuickly()
    

    If the test doesn't end after 100 milliseconds, it will fail.

提交回复
热议问题