JUnit TestNotFound 异常

JUnit TestNotFound Exception

我在 Eclipse 中使用注释测试和 运行 cleanInstall 创建了测试。然后尝试在 JSystem Runner 中 运行 它,但发现 TestNotFound 异常。

在 JSystem 中找到了测试,但未能通过 TestNotFound 运行 - 似乎代码或其他内容未正确加载。

我的例外:

   java.lang.Exception: Test not found
at junit.framework.ExecutionErrorTests.testNotFound(ExecutionErrorTests.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:66)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:105)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:86)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:94)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:98)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:54)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52)
at junit.framework.JSystemJUnit4ClassRunner.run(JSystemJUnit4ClassRunner.java:250)
at junit.framework.JUnit4TestAdapterForJSystem.run(JUnit4TestAdapterForJSystem.java:86)
at com.aqua.anttask.jsystem.JUnitTestRunner.run(JUnitTestRunner.java:461)
at com.aqua.anttask.jsystem.JSystemTask.executeInVM(JSystemTask.java:1388)
at com.aqua.anttask.jsystem.JSystemTask.execute(JSystemTask.java:957)
at com.aqua.anttask.jsystem.JSystemTask.executeOrQueue(JSystemTask.java:1806)
at com.aqua.anttask.jsystem.JSystemTask.execute(JSystemTask.java:897)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
at net.sf.antcontrib.logic.AntCallBack.execute(AntCallBack.java:54)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

我的测试:

public class DpUtilization extends BaseBBClass{


    private int value  = -1;

    private DpUtil dpUtil = null;

    public DpUtil getDpUtil() {
        return dpUtil;
    }

    @ParameterProperties(section = "Dp Utilization", description = "Choose Dp Utilization")
    public void setDpUtil(DpUtil dpUtil) {
        this.dpUtil = dpUtil;
    }


    public int getValue() {
        return value;
    }

    @ParameterProperties(section = "Dp Utilization", description = "Set Value")
    public void setValue(int value) {
        this.value = value;
    }

    @Test
    @TestProperties(name = "check DP Utilization", paramsInclude = { "DpUtil", "value"})
    public void testdpUtilization() throws Exception
    {
        report.report("final value: " + checkDpUtilization());
    }

}

我的基类:

public class BaseBBClass extends SystemTestCase4
{       

    @Override
    public void defaultBefore() throws Throwable
    {
    }

    @Override
    public void defaultAfter() throws Throwable
    {
    }
}

谢谢。 问题是测试应该 return 无效!