ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Hatton" <khat...@axiomsystems.com>
Subject RE: JUnit Task - can't see my test methods
Date Thu, 13 Mar 2003 13:05:00 GMT
Try adding fork="true" to your <junit> task.
All sorts of things mysteriously start working when you do this ...

Keith


-----Original Message-----
From: Karl.O'Brien@ie.consulting.fujitsu.com
[mailto:Karl.O'Brien@ie.consulting.fujitsu.com]
Sent: 13 March 2003 11:34
To: user@ant.apache.org
Subject: JUnit Task - can't see my test methods


Hi,

I'm having trouble with the JUnit ClassLoader problem as described in the
ANT FAQ.

Basically, to enable JUnit to see other libraries without putting them in
my system Classpath, I've removed optional.jar and junit.jar from the
ANT/lib directory and added:

<taskdef name="junit" classname
="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
      classpathref="junit.classpath"/>
<taskdef name="junitreport" classname
="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator"
      classpathref="junit.classpath"/>

to my build.xml.  junit.classpath has the locations of those 2 jars and my
source files.

But now when I run my tests, JUnit complains that each test class I have
contains no tests.  E.g.:
                                                                                         

                                                                                         

   No tests found in ccf.applicationlayer.businessdelegate.FileNoteBDTest                

                                                                                         

   junit.framework.AssertionFailedError: No tests found in                               

   ccf.applicationlayer.businessdelegate.FileNoteBDTest                                  

   Assert.java:47                                                                        

   TestSuite.java:263                                                                    

   TestCase.java:127                                                                     

   TestResult.java:106                                                                   

   TestResult.java:124                                                                   

   TestResult.java:109                                                                   

   etc..                                                                                 

                                                                                         

   My junit task looks like this:                                                        

   <junit showoutput="yes">                                                        
      
      <classpath refid="junit.classpath"/>                                         
      
      <formatter type="xml"/>                                                      
      
      <batchtest>                                                                  
      
         <fileset dir="${build.server.dir}/${project.ccfEntityBeans}">             
      
            <include name="**/*Test.class" />                                      
      
         </fileset>                                                                
      
      </batchtest>                                                                 
      
   </junit>                                                                        
      
                                                                                         

                                                                                         

                                                                                         

                                                                                         

                                                                                         

                                                                                         

                                                                                         



These tests ran fine previously (apart from the aforementioned ClassLoader
classpath problem in a few of them).  I haven't made any changes to the
test cases, and thery're all perfectly valid.

Has anybody any idea what may be causing junit not to see the test methods
inside the test cases?

Regards,
Karl.







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


Mime
View raw message