ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Bailliez <sbaill...@imediation.com>
Subject RE: Junit Problem
Date Thu, 28 Dec 2000 18:51:59 GMT
You are not using the JUnit task the correct way.
The name attribute in the test itself should be the classname. Not the
pathname.

Take a look at last example at
http://jakarta.apache.org/ant/jakarta-ant/docs/junit.html

-- 
 St├ęphane Bailliez 
 Software Engineer, Paris - France 
 iMediation - http://www.imediation.com 
 Disclaimer: All the opinions expressed above are mine and not those from my
company. 



> -----Original Message-----
> From: Dan MacKay [mailto:	
> Sent: Thursday, December 28, 2000 7:44 PM
> To: ant-user@jakarta.apache.org
> Subject: Junit Problem
> 
> 
> 
> Hi all,
> 
> I am getting the following error from the junit task using 
> the following
> target:
> 
> This is the target
>   <!--
> ==============================================================
> ===== -->
>   <!-- JUnit Target					        
>                                -->
>   <!--
> ==============================================================
> ===== -->
>   <target name="RunTests">
>     <junit printsummary="yes">
> 		<test name = 
> "${build.classes}.com.hcl.dal.DALTest" outfile="result" />
> 	</junit>
>   </target>	<!-- End of RunTests target -->
> 
> This is the error
>   D:\src\dal>ant -verbose -buildfile DalBuild.xml RunTests
>   Ant version 1.2 compiled on October 24 2000
> 
>   Buildfile: DalBuild.xml
>   Detected Java Version: 1.3
>   Detected OS: Windows NT
>   Project base dir set to: D:\src\dal
>   Build sequence for target `RunTests' is [RunTests]
>   Complete build sequence is [RunTests, prepare, document, clean,
> get_source, compile, jar, total-c     clean]
>   class path is: .\classes.com.hcl.dal.DALTest
>     [junit] Running .\classes.com.hcl.dal.DALTest
>     [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
>     [junit] TEST .\classes.com.hcl.dal.DALTest FAILED
> 
>   BUILD SUCCESSFUL
> 
>   Total time: 1 second
>   D:\src\dal>
> 
> When I try to fork I get the following NullPointerException
> 
>   D:\src\dal>ant -verbose -buildfile DalBuild.xml RunTests
>   Ant version 1.2 compiled on October 24 2000
> 
>   Buildfile: DalBuild.xml
>   Detected Java Version: 1.3
>   Detected OS: Windows NT
>   Project base dir set to: D:\src\dal
>   Build sequence for target `RunTests' is [RunTests]
>   Complete build sequence is [RunTests, prepare, document, clean,
> get_source, compile, jar, total-clean]
>   class path is: .\classes.com.hcl.dal.DALTest
> 
>   BUILD FAILED
> 
>   java.lang.NullPointerException
>         at
> org.apache.tools.ant.types.CommandlineJava.clone(CommandlineJa
> va.java:242)
>         at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute
> (JUnitTask.jav
> a:272)
>         at org.apache.tools.ant.Target.execute(Target.java:142)
>         at org.apache.tools.ant.Project.runTarget(Project.java:818)
>         at 
> org.apache.tools.ant.Project.executeTarget(Project.java:532)
>         at 
> org.apache.tools.ant.Project.executeTargets(Project.java:506)
>         at org.apache.tools.ant.Main.runBuild(Main.java:420)
>         at org.apache.tools.ant.Main.main(Main.java:149)
> 
> Has anyone any idea what is happening here? The tests run 
> fine using JUnit
> by itself.
> 
> 
> Dan MacKay
> 
> 

Mime
View raw message