JUnit TestNotFound Exception

271 views Asked by At

I created test in Eclipse with annotation test and ran cleanInstall. Then tried to run it in JSystem Runner but TestNotFound Exception Was Found.

The test was found in JSystem But failed to run with TestNotFound - Seems like code or something wasn't loaded correctly.

My Exception:

   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$2.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$1.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)

My Test:

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());
    }

}

My BaseClass:

public class BaseBBClass extends SystemTestCase4
{       

    @Override
    public void defaultBefore() throws Throwable
    {
    }

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

There are 1 answers

3
Sherein On BEST ANSWER

Thanks. The problem was that the test should return only void!