ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "P. Fleury" <fle...@users.sourceforge.net>
Subject JUnit: setUp() method called multiple times ?
Date Thu, 03 Oct 2002 04:16:30 GMT
Hello,

I have a single test class which has setUp() method. When I run it 
through the junit task, in batch, the setUp method gets called once for 
each test. Is that the normal behavior ? My problem is that multiple 
runs of setUp make things fail...

Anybody having similar issues?  Ant 1.5, Sun's JDK 1.4.0_01, Linux 
RH7.3, JUnit 3.7

--Pascal

###Here is the stub of my class (partially generated by NetBeans):

public class JNIContentManagerTest extends TestCase {
   
    public JNIContentManagerTest(java.lang.String testName) {
        super(testName);
    }
   
    public static void main(java.lang.String[] args) {
        junit.textui.TestRunner.run(suite());
    }
   
    public static Test suite() {
        TestSuite suite = new TestSuite(JNIContentManagerTest.class);
        return suite;
    }
   
    private MockContentManagerLink cml = null;
    private JNIContentManager    jnicm = null;
   
    private static int count_setups = 0;
   
    protected void setUp()  {
        count_setups++;
        System.err.println("setup #"+count_setups+" called.");
        // do initialization
    }
   
    public void testMultipleContentManagerLink() {
        System.out.println("testMultipleContentManagerLink");             
    }
   
   
    /** Test of createNewReference method, of class 
com.sony.vesta.jnicm.JNIContentManager. */
    public void testCreateNewReference() {
        System.out.println("testCreateNewReference");      
    }
   
    /** Test of getFilename method, of class 
com.sony.vesta.jnicm.JNIContentManager. */
    public void testGetFilename() {
        System.out.println("testGetFilename");
    }
      
}

### Ant the JUnit task:
      <junit fork="true" dir="${lib.dir}">
         <formatter extension=".xml" type="xml" usefile="true"/>
         <classpath refid="class.path"/>
            <sysproperty key="java.library.path" 
value="${ld.library.path}:${env.LD_LIBRARY_PATH}"/>
            <jvmarg value="-Xcheck:jni"/>
            <batchtest fork="true" todir="${testresults.dir}">
                <fileset dir="${class.dir}">
                    <include name="**/*Test.class"/>
                </fileset>
            </batchtest>
      </junit>




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


Mime
View raw message