关于JUnit initializationError(org.junit.runner.manipulation.Filter)错误

时间:2024-03-01 21:51:44

今天在测试时 JUnit时出现该错误,百度了好多方法,大部分说是忘记写@Test,仔细检查了下发现我写了,代码也没错,想了下是不是版本的问题,结果发现别的方法还能测

错误原因如下:

CurrentSessionTest.test31
initializationError(org.junit.runner.manipulation.Filter)
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test31], {ExactMatcher:fDisplayName=test31(com.zy.currentSession.CurrentSessionTest)], {LeadingIdentifierMatcher:fClassName=com.zy.currentSession.CurrentSessionTest,fLeadingIdentifier=test31]] from org.junit.internal.requests.ClassRequest@45ff54e6

at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:40)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:77)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:68)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

 最后,无意间发现应该是:       public void test4()

写成了 :     private void test4()