ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Rohead <SRoh...@webmiles.com>
Subject Problems with junit task
Date Mon, 19 Feb 2001 17:36:52 GMT
I am trying to get the junit task to work.  I've got junit.jar and
optional.jar in the classpath when invoking ant and am using the following
junit tag:

    <junit printsummary="true">
      <classpath>
        <path refid="classpath" />
        <pathelement location="${bin.dir}" />
        <pathelement location="${tst.dir}" />
      </classpath>

      <test name="com.webmiles.Test_All" />
    </junit>


This works and gives the following output on the console:

    [junit] Running com.webmiles.Test_All
    [junit] Tests run: 119, Failures: 0, Errors: 0, Time elapsed: 2.313 sec

However, I have searched my entire harddrive for any files called TEST-*.txt
and nothing is found.  I even tried to use the outfile property with an
explicit filename and still nothing.

Even stranger is when I break my testcases by adding a test which calls
fail() or assert(false) I get the following error message:

java.lang.AbstractMethodError
        at junit.framework.TestResult.addFailure(TestResult.java:46)
        at junit.framework.TestResult.runProtected(TestResult.java:127)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:121)
        at junit.framework.TestSuite.runTest(TestSuite.java:157)
        at junit.framework.TestSuite.run(TestSuite.java:152)
        at junit.framework.TestSuite.runTest(TestSuite.java:157)
        at junit.framework.TestSuite.run(TestSuite.java:152)
        at junit.framework.TestSuite.runTest(TestSuite.java:157)
        at junit.framework.TestSuite.run(TestSuite.java:152)
        at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:202)
        at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.jav
a:268)
        at org.apache.tools.ant.Target.execute(Target.java:142)
        at org.apache.tools.ant.Project.runTarget(Project.java:818)
        at org.apache.tools.ant.Project.executeTarget(Project.java:532)
        at org.apache.tools.ant.Project.executeTargets(Project.java:506)
        at org.apache.tools.ant.Main.runBuild(Main.java:420)
        at org.apache.tools.ant.Main.main(Main.java:149)


Running the junit test cases from the command line gives the expected
result:

FAILURES!!!
Test Results:
Run: 120 Failures: 1 Errors: 0
There was 1 failure:
1) test_fail(com.webmiles.ejb.Test_EjbEntityBean)
junit.framework.AssertionFailedError
        at junit.framework.Assert.fail(Assert.java:143)
        at junit.framework.Assert.assert(Assert.java:19)
        at junit.framework.Assert.assert(Assert.java:26)
        at
com.webmiles.ejb.Test_EjbEntityBean.test_fail(Test_EjbEntityBean.java:467)

        at java.lang.reflect.Method.invoke(Native Method)
        at junit.framework.TestCase.runTest(TestCase.java:155)
        at junit.framework.TestCase.runBare(TestCase.java:129)
        at junit.framework.TestResult$1.protect(TestResult.java:100)
        at junit.framework.TestResult.runProtected(TestResult.java:117)
        at junit.framework.TestResult.run(TestResult.java:103)
        at junit.framework.TestCase.run(TestCase.java:120)
        at junit.framework.TestSuite.run(TestSuite.java:144)
        at junit.framework.TestSuite.run(TestSuite.java:144)
        at junit.framework.TestSuite.run(TestSuite.java:144)
        at junit.textui.TestRunner.doRun(TestRunner.java:61)
        at junit.textui.TestRunner.run(TestRunner.java:181)
        at com.webmiles.Test_All.main(Test_All.java:11)



Is this happening to anyone else?

Sean

please CC my email as I have not subscribed to this mailing list.

Mime
View raw message