ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Moran <wmo...@collaborativefusion.com>
Subject Need help viewing output from failed ant/junit tests
Date Fri, 05 Mar 2010 14:35:54 GMT

Hello all.

I'm fairly new to ant, we've been working with it a few weeks for our
Java excursions and most things are rolling along pretty well.

We've also been building a lot of tests using JUnit, and we're trying
to get them configured in ant so we can automatically run them nightly
on a dedicated test system.

The problem I'm hitting is a few tests that run fine from our
workstations, but fail in the test environment.  This is obviously
because of some assumption the test is making about the environment,
but we're having trouble isolating and fixing the problem.

The problem I'm asking for help with, however, is getting test output
recorded when the tests run as an ant job.  Our ant task looks like this:

    <target name="test-lib" depends="compile-tests">
        <junit printsummary="withOutAndErr" fork="yes" forkmode="perTest"
         timeout="10000" maxmemory="512m" haltonfailure="no"
         tempdir="/tmp" failureProperty="test.failure">
            <batchtest todir="${build}/test/reports">
                <fileset dir="${build}">
                    <include name="**/*test.class"/>
                </fileset> 
            </batchtest>
            <formatter type="plain"/> 
            <classpath refid="test.classpath"/>
        </junit>
    </target>

Unfortunately, this doesn't give me any output anywhere.  The terminal
output for the test in question looks like:
    [junit] Running test.com.collaborativefusion.sharedlib.SQL.Sql_list_test
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] Test test.com.collaborativefusion.sharedlib.SQL.Sql_list_test FAILED (timeout)

and the log file:
Testsuite: test.com.collaborativefusion.sharedlib.SQL.Sql_list_test
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec

Testcase: test_list_exists took 0.002 sec
        Caused an ERROR
Timeout occurred. Please note the time in the report does not reflect the time until the timeout.
junit.framework.AssertionFailedError: Timeout occurred. Please note the time in the report
does not reflect the time until the timeout.


There are a few System.out.println()s that _have_ to be running (and many
more that might be, depending on what's causing the timeout).  For example,
when I run the test from Netbeans, this is the output I see:
entering setUp() for test class
leaving setUp() for test class
Entering test_list_exists()
Leaving test_list_exists()
entering setUp() for test class
leaving setUp() for test class
Entering test_get_list()
Leaving test_get_list()

The code is nothing fancy, just:
System.out.println("entering setUp() for test class");

Any advice on how to configure the ant task so I can capture that output?

Running ant-1.7.1 on FreeBSD 8.0 with JUnit 4.8.1.

Thanks in advance.

-- 
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message