1. 程式人生 > >java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testQueryById],

java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testQueryById],

有時候測試的時候會出現下面的錯誤,明明程式碼和環境都沒有問題,就是出現不匹配的想象。
解決方法:不通過run as開啟單元測試,直接執行測試程式,會發現竟然並沒有錯誤。
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testQueryById], {ExactMatcher:fDisplayName=testQueryById(org.seckill.dao.SeckillDaoTest)], {LeadingIdentifierMatcher:fClassName=org.seckill.dao.SeckillDaoTest,fLeadingIdentifier=testQueryById]] from

[email protected]
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35)
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:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)