Home
DevelopTools
Error --java.lang.Exception: No runnable methods
DevelopTools
Error --java.lang.Exception: No runnable methods
Error --java.lang.Exception: No runnable methods
2010-01-21 22:08 | 作者:Administrator
原因是使用了Junit4.x进行单元测试,if you use the JUnit 4.4 core runner to execute a class, you must have "@Test" method in the class.
主要检查你是否在要测试的方法前加上@Test。
网上找的替他原因:
Your unit test code is running JUnit4. At least one test method must have the @Test annotation. Otherwise this error occurs.
If the class you are testing has @Required setters for Spring injections they must be set otherwise JUnit will mask the missing required exception as a no runnable methods exception.
If you are initializing your mock objects outside of the @Begin method you will get this error.
If you are attempting to mock the same class more than once you will get this error.