ant-user mailing list archives

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

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


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

public class JNIContentManagerTest extends TestCase {
    public JNIContentManagerTest(java.lang.String testName) {
    public static void main(java.lang.String[] args) {;
    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()  {
        System.err.println("setup #"+count_setups+" called.");
        // do initialization
    public void testMultipleContentManagerLink() {
    /** Test of createNewReference method, of class */
    public void testCreateNewReference() {
    /** Test of getFilename method, of class */
    public void 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" 
            <jvmarg value="-Xcheck:jni"/>
            <batchtest fork="true" todir="${testresults.dir}">
                <fileset dir="${class.dir}">
                    <include name="**/*Test.class"/>

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

View raw message