Menu

Ant and JXUnit

2001-11-20
2001-11-21
  • Thomas Nichols

    Thomas Nichols - 2001-11-20

    Good Day,

    JXUnit seems to be behaving well under Linux -- but I do not see JXUnit error messages when it's driven by Ant. Has anyone else tried to do this? Using Ant is my preferred way of avoiding platform dependencies in build / test scripts.

    When run "raw" - i.e. from the command line (with a test.jxu which forces a failure):

    $java junit.textui.TestRunner net.sourceforge.jxunit.JXTestCase
    .F
    Time: 1.037
    There was 1 failure:
    1) /home/thomasn/src/delta/test/jxunit(net.sourceforge.jxunit.JXTestCase)junit.framework.AssertionFailedError: Forced Failure - toast!
        at net.sourceforge.jxunit.JXTestIsEqual.eval(JXTestIsEqual.java:27)
        at net.sourceforge.jxunit.JXDo.eval(JXDo.java:15)
        at net.sourceforge.jxunit.JXTestCase.runTest(JXTestCase.java:217)

    FAILURES!!!
    Tests run: 1,  Failures: 1,  Errors: 0

    ====

    When run from Ant with the following build.xml:

    <?xml version="1.0"?>
    <!-- $Id: $ -->
    <!-- DeltaXML JXUnit test driver build file -->

    <project name="dxtest" default="all" basedir=".">
               
      <target name="all">
        <junit fork="no" haltonfailure="yes" printSummary="yes">
          <test name="net.sourceforge.jxunit.JXTestCase" />
        </junit>
      </target>
    </project>

    I get the following output:

    $ant
    Buildfile: build.xml

    all:
        [junit] Running net.sourceforge.jxunit.JXTestCase
        [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.731 sec

    BUILD FAILED

    /home/thomasn/src/delta/test/jxunit/build.xml:8: Test net.sourceforge.jxunit.JXTestCase failed

    Total time: 2 seconds
    $

    i.e. I get no detail of the cause of the error.

    When the test.jxu does not force a failure, Ant duly reports "BUILD SUCCESSFUL".

    Q: How do I get to see the JXUnit error messages when invoking JXUnit as a <junit> task within Ant?

    I am also hunting through the Ant and JUnit archives to see if I can find any pointers there.
    Thanks,
    Thomas.

     
    • Bill la Forge

      Bill la Forge - 2001-11-21

      Try having ant fork the test onto a different runtime environment. Its a thought anyway.

      B-)

       
      • Thomas Nichols

        Thomas Nichols - 2001-11-21

        Thanks for the suggestion -- fork="yes" had indeed improved things, especially when I hardcoded the <classpath>.
            - Thomas.

         

Log in to post a comment.