ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikael Petterson \(KI/EAB\)" <mikael.petter...@ericsson.com>
Subject RE: Junit test fails in ant but not in Eclipse
Date Fri, 09 Mar 2007 08:41:54 GMT
Hi,

I used 1.5 but got the same NullPointerException. Since I don't get it
in eclipse it is hard to debug.
I am thinking of using Netbeans to debug an instance of Ant. 
Any other ideas on how to approach?

Cheers,

//mikael 

-----Original Message-----
From: Mikael Petterson (KI/EAB) [mailto:mikael.petterson@ericsson.com] 
Sent: den 9 mars 2007 08:32
To: Ant Users List
Subject: RE: Junit test fails in ant but not in Eclipse

Hi,

So it could be that Eclipse uses these libraries in the classpath when
executing tests but ant isn't?
I tried running ant with -debug but I could not see any more than
before.

I am using ant 1.6.2, Eclipse 3.2 and junit 3.8.1

I am running  a test where I create a number of static Mock objects.


Cheers,

//mikael

Ps. I will try to execute ant with 1.5 ( even if code compiles with
1.3.1).




-----Original Message-----
From: Brown, Carlton [mailto:Carlton.Brown@BellSouth.com]
Sent: den 7 mars 2007 16:11
To: Ant Users List
Subject: RE: Junit test fails in ant but not in Eclipse

I found that prior to Java 1.5 I had to have these libs on the
classpath:

jaxb-libs.jar
jaxp-api.jar
sax.jar
xercesImpl.jar
xalan.jar
xsltc.jar

We jumped straight from 1.3 to 1.5 so I don't know if 1.4 is missing
these libs.

Perhaps 1.4.2 has these libs, or your wrapper script is somehow putting
them on your system classpath?

-----Original Message-----
From: Mikael Petterson (KI/EAB) [mailto:mikael.petterson@ericsson.com]
Sent: Wednesday, March 07, 2007 9:57 AM
To: Ant Users List
Subject: RE: Junit test fails in ant but not in Eclipse

Hi,

Thanks for reply.

When I ran in Eclipse I did use  "run as junit". When I ran Ant I use a
shell script that starts Ant with junit in classpath.

I start Eclipse with a wrapper script and I use:

1.4.2_08

I have the same setting for my ant wrapper script.

When you say that it is usually classpath dependt. Is it the order in
the classpath or is there some actual lib missing?

Cheers,

//mikael 


-----Original Message-----
From: Brown, Carlton [mailto:Carlton.Brown@BellSouth.com]
Sent: den 7 mars 2007 15:36
To: Ant Users List
Subject: RE: Junit test fails in ant but not in Eclipse

These things almost always come down to classpath but it's hard to tell
without more info.   In particular I found that Java 1.3 and 1.4 are
missing a lot of libs needed to run junit, but Java 1.5 already comes
with everything.

When you say you ran it in Eclipse, did you simply select "run as junit"
or did you launch the Ant script from Eclipse?
When you say you ran it in Ant, did you launch the Ant script from
Eclipse, or did you run it by hand on the command line?
Are you launching Eclipse with the same VM that you see when you type
"java -version" at your command line?

-----Original Message-----
From: Mikael Petterson (KI/EAB) [mailto:mikael.petterson@ericsson.com]
Sent: Wednesday, March 07, 2007 5:57 AM
To: user@ant.apache.org
Subject: Junit test fails in ant but not in Eclipse

Hi,

I run a junit test ( junit 3.8.1 in both) in Eclipse it works just fine.
Then I run the test in Ant using:

<target  name="test:test" depends="test:postcompile" description="run
all tests">
  <junit showoutput="yes" printsummary="on"  haltonfailure="no"
fork="on" failureproperty="junit_test_failed" forkmode="perBatch">
    <jvmarg value="-Xmx756M" />
    <jvmarg
value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma" /> 
    <jvmarg value="-Demma.coverage.out.merge=true" /> 
    <classpath>
     <pathelement location="${out.instr.dir}"/>
     <pathelement location="${test.classes.dir}"/>
     <pathelement location="${classes.dir}"/>
     <path refid="test.classpath"/>
     <path refid="emma.lib" />
   </classpath>
   <!--<formatter type="brief" usefile="true"/>-->
   <formatter type="xml" usefile="true"/>
    <batchtest todir="${coverage.dir}">
     <fileset dir="${test.classes.dir}">
      <!--<include name="**/TestItAllCreate*"/>-->
      <!--<include name="**/TestRecover*"/>-->
      <include name="**/TestItAll.class"/>
      <exclude name="**/alarm/tb/sut/*Test.class"/>
      <include name="**/sut/*Test.class"/>
      <exclude name="**/mock/**"/>
     </fileset>
    </batchtest>
   </junit>
   </target>

The test fails with an NullPointerException.

How are junit tests executed in ant?

Anyone knows if the jvm is restarted per suite or something. Since there
must be differences in what objects are still in the environment.
All ideas and hints are greatly appreciated!

Cheers,

//mikael

*****

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential, proprietary, and/or
privileged material. Any review, retransmission, dissemination or other
use of, or taking of any action in reliance upon this information by
persons or entities other than the intended recipient is prohibited. If
you received this in error, please contact the sender and delete the
material from all computers. GA624



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


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


*****

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential, proprietary, and/or
privileged material. Any review, retransmission, dissemination or other
use of, or taking of any action in reliance upon this information by
persons or entities other than the intended recipient is prohibited. If
you received this in error, please contact the sender and delete the
material from all computers. GA621



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


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


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


Mime
View raw message