initializationError(org.junit.runner.manipulation.Filter), No tests found matching型异常
来源:互联网 发布:linux nat配置转发 编辑:程序博客网 时间:2024/05/15 03:07
package soundsystem;import static org.junit.Assert.*;import org.junit.Test;import org.junit.runner.RunWith;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.test.context.ContextConfiguration;import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(classes = CDPlayerConfig.class)public class CDPlayerTest {@Autowiredprivate CompactDisc cd;@Testpublic void cdShouldNotBeNull(){assertNotNull(cd);}}
在进行一个简单的Junit测试的时候报异常,测试不能正确通过。
使用的Spring-framework版本是4.3.4,Junit版本是4.12,测试一直不通过,报出下面这样的异常:
CDPlayerTest.cdShouldNotBeNullinitializationError(org.junit.runner.manipulation.Filter)java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=cdShouldNotBeNull], {ExactMatcher:fDisplayName=cdShouldNotBeNull(soundsystem.CDPlayerTest)], {LeadingIdentifierMatcher:fClassName=soundsystem.CDPlayerTest,fLeadingIdentifier=cdShouldNotBeNull]] from org.junit.internal.requests.ClassRequest@27f8302dat 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: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)
一直没有找到原因,更换Junit版本到4.10还是不行,后来将Spring-framework版本后退到3.2.14,测试顺利通过,可能就是Spring-framework和Junit不兼容问题。
在网上查找资料时,好多说忘记加@Test注解也会报这个类型的错误,在测试已经成功的条件下,去掉@Test注解,果然报了同样的错误。
CDPlayerTest.cdShouldNotBeNullinitializationError(org.junit.runner.manipulation.Filter)java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=cdShouldNotBeNull], {ExactMatcher:fDisplayName=cdShouldNotBeNull(soundsystem.CDPlayerTest)], {LeadingIdentifierMatcher:fClassName=soundsystem.CDPlayerTest,fLeadingIdentifier=cdShouldNotBeNull]] from org.junit.internal.requests.ClassRequest@73a28541at 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: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)和上面报的异常一样。所以如果遇到initializationError(org.junit.runner.manipulation.Filter) , java.lang.Exception: No tests found matching型异常;
首先考虑是否忘记@Test注解;如果不是,再考虑是否是框架版本不匹配问题,更换版本后,一般都能解决问题。
0 0
- initializationError(org.junit.runner.manipulation.Filter), No tests found matching型异常
- HibernateIDTest.testUpdate Unrooted Tests initializationError(org.junit.runner.manipulation.Filter)
- Unrooted Tests initializationError(org.junit.runner.manipulation.Filter)
- initializationError(org.junit.runner.manipulation.Filter) java.lang.Exception: No tests
- initializationError(org.junit.runner.manipulation.Filter)
- initializationError(org.junit.runner.manipulation.Filter)
- JUnit initializationError(org.junit.runner.manipulation.Filter)错误
- Spring4.3.0 Junit4.11 initializationError(org.junit.runner.manipulation.Filter)
- No tests found matching 【junit 异常】
- junit异常(No tests found matching)
- JUnit4 测试 Parameterized 报错Unrooted Tests : No tests found matching Method initializationError解决方法
- 【遇到的异常】initializationError(Runner:JUnit 4)
- JUnit:java.lang.Exception: No tests found matching Method ***
- Junit报错:java.lang.Exception: No tests found matching
- Junit测试问题:java.lang.Exception: No tests found matching
- no junit tests found
- JUnit的报错“No tests found with test runner JUnit4”
- No tests found with test runner JUnit4
- 极大似然估计
- 硬盘的类型与维护
- 第十二周项目4 利用遍历思想求解图问题(7)
- 译码器模块
- C语言实验——输出字符串
- initializationError(org.junit.runner.manipulation.Filter), No tests found matching型异常
- LeetCode解题报告 241. Different Ways to Add Parentheses [medium]
- 时间日期相关
- 用PL/SQL连接虚拟机中的oracle数据库
- ROS机器人操作系统
- 大理石在哪
- django Field选项中null和blank的区别
- 第三十二讲项目3-输出星号正倒三角
- 作业一:解析文件,封装到一个java对象,依次放到List中