Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
JUnit Task - can 't see my test methods

JUnit Task - can 't see my test methods

2003-03-13       - By Karl.O'Brien@(protected)
Reply:     1     2     3  

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.








©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.