ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen McConnell" <>
Subject RE: AW: Broken Junit targets
Date Thu, 16 Feb 2006 13:39:06 GMT

> -----Original Message-----
> From: Taemin Cim [] 
> Sent: Thursday, 16 February 2006 1:22 PM
> To:
> Subject: RE: AW: Broken Junit targets
> Hi All,
> Thanks so much for your help so far!  But the saga continues...
> I tried Jans approach, as well as some others.
> Steve suggested the -v option, so I'm going to lay it all out here.

The suggestion to run ant with the verbose switch (-v) was to get *you* to
look at what *your* build is doing on *your* system.  Based on your earlier
comments it appears to me that something has changed on your system which is
resulting in the unexpected failure of the build and basically you'll need
to figure out what that problem is.  Rather than trying to debug a build as
is - I suggest you focus on the immediate issue of resolving the problem you
have with the junit task execution.  You can do this reasonably easily by
creating a simple testcase and a minimal build file.  

For example:

  1. create a new directory somewhere
  2. create the following java source file in that directory


     import junit.framework.TestCase;

     public class DemoTestCase extends TestCase
         public void testSomething() throws Exception
             System.out.println( "Hello" );

  3. create a build file that will execute this testcase

     <?xml version="1.0" encoding="UTF-8" ?>
     <project name="demo" default="test">

       <target name="build">
         <javac srcdir="." destdir=".">
       <target name="test" depends="build">
         <junit fork="true" dir="." 
            printsummary="yes" showoutput="true">
             <pathelement location="."/>
           <formatter type="plain"/>
           <batchtest fork="yes" todir=".">
             <fileset dir=".">
               <include name="*"/>

  4. run the build

     $ ant

  5. check the output (should be something like the following)

     | Buildfile: build.xml
     | build:
     |     [javac] Compiling 1 source file to C:\dev\test\sample
     | test:
     |     [junit] Running DemoTestCase
     |     [junit] Hello
     |     [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.015
     | Total time: 2 seconds

  6. if the build does not complete successfully then run ant again with the

     verbose option and try and figure out the reason (which should be clear
     given the simplicity of the project definition)

  7. if the build is ok then compare what is happening in the sample build
     your project (possibly by modifying the test project to use similar
     path definitions, test task parameterization, and so forth).

Good luck!

Cheers, Steve.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message