maven - fail build when unit test takes too long

后端 未结 6 2121
广开言路
广开言路 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 20:46

    Have you tried specifying the timeout for the test through @Test(timeout=xx)? Find the official api documentation here: http://junit.sourceforge.net/javadoc/org/junit/Test.html

    EDIT---

    You can also consider using the timeout property for the TestNg suite, you will have to move all your tests to TestNg though, but this will allow you to specify timeouts for groups.

    This is the official api documentation: http://testng.org/javadoc/org/testng/xml/XmlSuite.html#setTimeOut(java.lang.String)

提交回复
热议问题