ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sk...@vtechphones.com
Subject Unable to get junit task to work
Date Tue, 02 Mar 2004 18:51:02 GMT
Forgive me I'am a newbie at this,
 
I'm able to run test ant build files successfully (compile, copy, even
ftp) and I am able to run junit tests on their own using java
junit.textui.TestRunner or java junit.swingui.TestRunner but I cannot
get junit tests to run from within ant.  The output states the tests
have run with 0 failures but it also states that (in the case of this
test), there were 2 Errors.
 
My first problem is I don't know how to get the Error detail (is there a
log file or debug flag to set? I tried ant -d but it gave no detail on
the Errors).  And my second problem is I cannot determine why I can run
the test with not problem using junit commandline but not from a simple
ant buildfile??
 
Please help, let me know of anymore details you may need.
 
I have junit.jar and the path for junit.samples.AllTests in my
classpath.
I also have junit.jar in ANT_HOME\lib
 
My testing directory structure is.
E:\java\junit3.8.1\
E:\java\junit3.8.1\build.xml
E:\JAVA\junit3.8.1\junit\tests\AllTest.class
 
I'm using ant 1.6 & junit 3.8.1 (though I've also tried ant 1.5.4) on
Win2K (have also tried in Fedora)
 
If I run junit on its own I get the following input.
E:\JAVA\junit3.8.1>java junit.textui.TestRunner junit.samples.AllTests
.........................................
.........................................
.....................................
 
 
Time: 0.731
 
OK (119 tests)
 
But if I use this build.xml.
<?xml version="1.0" ?>
<project name="eMarket" default="unittest">
    <!-- unittest target -->
    <target name="unittest"
            description="Run the unit tests for the source code."> 
        <junit printsummary="yes" showoutput="yes">
            <test
             name="junit.samples.AllTests"
             />
        </junit>
    </target>
</project>
 
I get this. (note the 2 Errors)
E:\JAVA\junit3.8.1>ant
Buildfile: build.xml
 
unittest:
    [junit] Running junit.samples.AllTests
    [junit] Tests run: 119, Failures: 0, Errors: 2, Time elapsed: 0.771
sec
 
    [junit] TEST junit.samples.AllTests FAILED
 
BUILD SUCCESSFUL
Total time: 1 second
 
Any Help Greatly appreciated.
 
Sam Keen
Vtech AAT
Application Developer
9590 SW Gemini dr
Suite 120
Beaverton, OR 97008
 <mailto:skeen@vtechphones.com> skeen@vtechphones.com


 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message