java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=getSession]
2017-12-05 10:27
495 查看
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=getSession], {ExactMatcher:fDisplayName=getSession(com.gp.utils.SessionUtils)], {LeadingIdentifierMatcher:fClassName=com.gp.utils.SessionUtils,fLeadingIdentifier=getSession]] from org.junit.internal.requests.ClassRequest@73e373de
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:37)
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)
这个错误我是因为测试的这个方法有返回值 ,当去掉返回值时就对了
代码如下
@Test
public static SqlSession getSession() throws Exception{
InputStream inputStream = Resources.getResourceAsStream("sqlMapConfig.xml");
System.out.println(inputStream);
SqlSessionFactory build = new SqlSessionFactoryBuilder().build(inputStream);
session = build.openSession();
return session;
}
所以要测试这种有返回值的方法时候 ,可以在创建一个方法测试,或者去掉返回值,在方法内先输出返回值,测试通过了在加回去
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:37)
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)
这个错误我是因为测试的这个方法有返回值 ,当去掉返回值时就对了
代码如下
@Test
public static SqlSession getSession() throws Exception{
InputStream inputStream = Resources.getResourceAsStream("sqlMapConfig.xml");
System.out.println(inputStream);
SqlSessionFactory build = new SqlSessionFactoryBuilder().build(inputStream);
session = build.openSession();
return session;
}
所以要测试这种有返回值的方法时候 ,可以在创建一个方法测试,或者去掉返回值,在方法内先输出返回值,测试通过了在加回去
相关文章推荐
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=findAll], {ExactMatcher:fDi
- junit运行测试报异常:java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName......
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=findAll], {ExactMatcher:fDi
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testQueryById(long)], {Lead
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test]解决办法
- 使用jutil测试程序出现错误java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=classestest]
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test]解决办法
- junit test 报错,java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=esopCreateTest],
- No tests found matching [{ExactMatcher:fDisplayName=getClassesTest], {ExactMatcher:fDisplayName=get
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testDemo]出现原因及解决办法
- java.lang.Exception: No tests found matching
- 谈一谈JUnit神奇的报错 java.lang.Exception:No tests found matching
- spring-test+junit测试出现java.lang.Exception: No tests found matching
- Junit报错:java.lang.Exception: No tests found matching
- 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
- java.lang.Exception: No tests found matching
- Junit测试问题:java.lang.Exception: No tests found matching