JUnit testing got initializationError with java.lang.Exception: No tests found matching

后端 未结 8 1545
别那么骄傲
别那么骄傲 2021-01-01 18:59

When running JUnit testing , it gave an initializationError: No tests found matching. Like this:

prodapi-main-junit
initializationError(org.junit.runner.man         


        
8条回答
  •  醉酒成梦
    2021-01-01 19:39

    Check for below conditions:

    1. Have you used org.junit.jupiter.api.Test; instead of org.junit.Test; for running Junit 4 test cases?
    2. Have you passed an argument to the test method as shown below:

    public void test(String arg){ assertTrue(true); }

    1. Re-building a project will also work:

      mvn clean install

提交回复
热议问题