JUnit:java.lang.Exception: No tests found matching Method ***
2016-11-15 15:49
686 查看
运行测试代码显示以下错误:
java.lang.Exception: No tests found matching Method deleteById(cn.bytestream.mongodb.MongoDB4CRUDTest) from org.junit.internal.requests.ClassRequest@2cb0ce8f at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestMethodReference.<init>(JUnit4TestMethodReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:54) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
问题截图如下:
解决办法:
因为deleteById方法是Run As –> Junit Test, 而该方法之前未添加@Test标签所导致,无法找到方法;注意查看你的测试方法前@Test 是否存在!
参考博文:java.lang.Exception: No tests found matching Method *
另外,完成本博文还参考:CSDN-markdown编辑器语法——字体、字号与颜色
相关文章推荐
- 谈一谈JUnit神奇的报错 java.lang.Exception:No tests found matching
- junit运行测试报异常:java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName......
- JUnit神奇的报错 java.lang.Exception:No tests found matching
- 谈一谈JPA遇到的:JUnit神奇的报错 java.lang.Exception:No tests found matching
- Junit测试问题:java.lang.Exception: No tests found matching
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=getSession]
- java.lang.Exception: No tests found matching
- Junit报错:java.lang.Exception: No tests found matching
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=findAll], {ExactMatcher:fDi
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test]解决办法
- junit test 报错,java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=esopCreateTest],
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=findAll], {ExactMatcher:fDi
- java.lang.Exception: No tests found matching
- spring-test+junit测试出现java.lang.Exception: No tests found matching
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testDemo]出现原因及解决办法
- java.lang.Exception: No tests found matching
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testQueryById(long)], {Lead
- java.lang.Exception: No tests found matching
- 使用jutil测试程序出现错误java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=classestest]
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test]解决办法