Hi, All: I am new to JUnit, but not so much to Ant. I got JUnit 3.8.1 today and ran succesfully a few tests, both with GUI or TextUI. However, I encountered a problem integrating Ant to Junit. According to Ant's documentation, I put junit.jar into ANT_HOME/lib where ant.jar and optional.jar are. The following are what I have got when I started to run: <target name="runtest"> <junit><test name="FirstHinTest"/></junit> </target>
It first complains about not being able to creat task <junit>. I thought as long as optional.jar and junit.jar are in the ANT_HOME/lib, it should just recognize the junit as one of the optional Ant tasks and run it (that's the impression I got from documentation). Anyways, I put in <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/> to define the tast and it showed me another error: java.lang.NoClassDefFoundError: org/apache/tools/ant/ProjectComponent Since this class is in ant.jar, so I put ANT_HOME/lib/ant.jar in the CLASSPATH. Then it gives me this error: java.lang.VerifyError: (class: org/apache/tools/ant/taskdefs/optional/ide/VAJExp ort, method: execute signature: ()V) Incompatible object argument for function call This really get me stuck and puzzled. This looks like a mismatch in class definiations. I must be missing something seriously. Any help is appreciated.
Tony Yan<br /> <br />IBM Certified Developer XML and Related Technology<br />Sun Certified Web Component Developer For J2EE Platform<br />Sun Certified Programmer For Java 2 Platform
Joined: Jan 26, 1999
I recently setup Ant using JUnit. My first solution was to put the junit.jar in the ANT_HOME/lib directory. I do have a system environment variable set for ANT_HOME = C:\jakarta-ant-1.5 and no classpath. This worked. Have you checked your definition of ANT_HOME? My second solution was to leave the junit.jar in the JUNIT_HOME. I have defined a classpath which includes: C:\Junit3.8.1\junit.jar and I have ANT_HOME = C:\jakarta-ant-1.5 Irene
Joined: Apr 10, 2002
You are right. I have solved this problem a few days ago. The problem was my PC has been upgraded and I forgot to put int ANT_HOME. oops. Thanks anyways.
Joined: Sep 18, 2003
Hi, When I run my ant test for a class from GUI through my IDE I get an "assertion failed" error when it is supposed to. But at the same instance if I run "ant junit" it shows me successful for the build. Please solve my problem. Thanks n regards vijay
Joined: Jan 23, 2002
Vijay, please don't crosspost a question into several threads. Discussion related to Vijay's question should be continued in the other thread. [ December 30, 2003: Message edited by: Lasse Koskela ]