好久没玩Junit了,遇到一个摸不着头脑的异常
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=tesGetPowerConsumption], {ExactMatcher:fDisplayName=tesGetPowerConsumption(com.ningji.junit.ListenValue2DaoTest)], {LeadingIdentifierMatcher:fClassName=com.ningji.junit.ListenValue2DaoTest,fLeadingIdentifier=tesGetPowerConsumption]] from org.junit.internal.requests.ClassRequest@1a6c5a9e
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:40)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:80)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:71)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:46)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:522)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
说没用匹配的测试,但是测试方法是存在的,在网上找了不少解答都没有解决问题,最后发现,Junit的测试方法名必须以test开头,否则就会报这个错