Hi,
I wrote one ant script which will do the follwoing:
1) compiles all java files and makes jar file
2) this jar file is deployed to jboss
3) After deploying I need to test the code using junit
I have some problem by the time of testing using junit:
The problem is:
I am getting the following error when i try to run the command:
c:/gonehome> ant -buildfile test.xml
junit:
[junit] Running gonehome.test.ejb.TestEJB
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] TEST gonehome.test.ejb.TestEJB FAILED
Why is this failing? If i test that thru jbuilder it is working fine.
But when i try to run that using ant script i am getting the above error:
My jar file is under jboss deploy directory and the TestEJB.java
is under c:\gonehome\test\ejb folder
The jar file successfully deployed into jboss but the problem is with junit.
Any help please...
Here is the code i am using..
<?xml version="1.0" encoding="ISO-8859-1" ?>
<project name="test" default="all" basedir=".">
<property name="ejb-jar.filename" value="test.jar"/>
<property name="dist.dir" location="dist"/>
<property name="inf.dir" location="META-INF"/>
<patternset id="class.files">
<include name="**/**/**/*.class" />
</patternset>
<patternset id="source.files">
<include name="**/**/**/*.java" />
</patternset>
<patternset id="xml.files">
<include name="META-INF/*.xml" />
</patternset>
<patternset id="junitTest.files">
<include name="**/test/**/**/*.java" />
</patternset>
<path id="full_classpath">
<pathelement location="c:\gonehome\test\server\lib\j2ee.jar" />
</path>
<target name="compile" depends="clean" >
<javac srcdir="." debug="on" >
<classpath refid ="full_classpath" />
<patternset refid ="source.files" />
<patternset refid = "junitTest.files" />
</javac>
</target>
<target name="jar" depends="compile" >
<mkdir dir="${dist.dir}/lib"/>
<mkdir dir="${inf.dir}" />
<jar jarfile="${dist.dir}/lib/${ejb-jar.filename}" basedir="." >
<patternset refid="class.files" />
<patternset refid="source.files" />
<patternset refid="xml.files" />
</jar>
<copy file="${dist.dir}/lib/${ejb-jar.filename}" todir="c:/jboss-3.2.1/server/default/deploy"/>
</target>
<target name="all" depends="jar" >
<junit printsummary="yes" errorproperty="yes" showoutput ="yes" >
<classpath>
<pathelement location="c:\ant\lib\junit.jar" />
<pathelement location="c:\jboss-3.2.1\server\default\deploy\test.jar" />
</classpath>
<test name=" test.ejb.TestEJB" />
</junit>
</target>
</project>