ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From theis.megge...@se.abb.com
Subject Peculiar behaviour of junit task
Date Mon, 12 Aug 2002 07:31:20 GMT
Hi everybody!

When I run my JUnit testcases via the IDE (eclipse) both as applications
and as JUnit test everything works well.
But when I run them (i.e. testcases) via ant my assertion code fails. Here
is some java code:

     public GenericPoolMetaData metaData;
     public IXElementPool pool;

     /**
      * @see TestCase#setUp()
      */
     protected void setUp() throws Exception
     {
          //super.setUp();
          metaData = new GenericPoolMetaData();
          metaData.setDebugging(false);
          metaData.setMaximumSize(10);
          metaData.setMinimumSize(5);
          metaData.setInitialObjects(5);
          metaData.setName("pool");

          pool = new IXElementPool(metaData);

     }


     public void testRequestingElements()
     {
          this.assertNotNull(pool);
          this.assertEquals("pool", pool.getPoolname());
          System.out.println(pool.numCheckedInObjects()); // Just a
confirmation.
          this.assertEquals(5, pool.numCheckedInObjects());
          this.assertEquals(0, pool.numCheckedOutObjects());

          IXElement element = (IXElement) pool.requestObject();
          this.assertNotNull(element);
          this.assertEquals(4, pool.numCheckedInObjects());
          this.assertEquals(1, pool.numCheckedOutObjects());
     }

Here is the ant code:

      <junit printsummary="true">
        <formatter type="xml" />
        <classpath>
          <pathelement path="${classes.dir}" />

          <fileset dir="${lib.dir}">
            <exclude name="xerces.jar"/>
            <exclude name="crimson.jar"/>
            <include name="**/*.jar"/>
          </fileset>

          <fileset dir="${ext.dir}">
            <include name="**/*.jar"/>
          </fileset>
        </classpath>
        <!-- All tests -->
        <test name="test.com.abbmcls.xml.util.IXElementPoolTest" />
      </junit>

      <junitreport todir="./report">
        <fileset dir="./">
          <include name="TEST-*.xml"/>
        </fileset>
        <report format="frames" todir="./report" />
      </junitreport>

When I run it via ant the test for number of checked in objects (pool.numCheckedInObjects())
will fail asserting that
the expected result is 5 but the actual is 0.

Any idea?

Thanks in advance,

/Theis.


--
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