java.lang.Exception: No tests found matching Method using Intellij IDEA

后端 未结 12 2227
说谎
说谎 2020-12-14 14:12

I am experiencing a strange behavior of Intellij IDEA 2016.3. Having a class with method foo and a JUnit test for the method when I get java.lang.Exceptio

12条回答
  •  感情败类
    2020-12-14 14:57

    Since you got your answer and for others searching for solution,

    Look if your test class is extending TestCase abstract class which is a JUnit 3 related. In order to fix this you have to start your method name with "test". For example public void testFoo().

    If JUnit 3 is not the case, you're missing @Test annotation from your JUnit 4 test method.

    Note: If you're extending from TestCase and test methods are annotated with @Test and also your methods' names start with "test", then probably you're mixing JUnit 3 with JUnit 4. Don't do that. It will lead to other errors such as methods that annotated with @Ignore will not be ignored if those methods' names start with "test".

提交回复
热议问题