IntelliJ Java IDE
The moose likes Ant, Maven and Other Build Tools and the fly likes Help need Running JUnit Test cases from ANT Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "Help need Running JUnit Test cases from ANT" Watch "Help need Running JUnit Test cases from ANT" New topic
Author

Help need Running JUnit Test cases from ANT

A Venkat
Greenhorn

Joined: Aug 02, 2004
Posts: 1
Hi Group,

I have created a JUnit Test Case which contains

import junit.framework.*;
public class Test extends TestCase {
public void test()
{
assertEquals( "Equality Test", 0, 1 );
}

}


and I created a build.xml file":



<project name="Test" default="all" basedir="C:\JUnit">

<property name="tst-dir" value="." />
<property name="res-dir" value="C:\JUnit\Results" />

<target name="all" depends="test" />

<target name="test" depends="compile-test">

<echo>Test Cases</echo>

<junit >


<formatter type="xml" />

<batchtest>

<fileset dir="${tst-dir}\Classes" >
<include name ="${tst-dir}\Classes\*Test.class" />

</fileset>

</batchtest>
</junit>
</target>


<target name="compile-test" >

<javac srcdir="${tst-dir}" destdir="${tst-dir}\classes" />

</target>


<junitreport>

<fileset dir="${res-dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="noframes"/>
</junitreport>

</project>

and Now I ran it from command prompt...it;s saying BUILD successfull. and also generating Test Report also with

Tests=0 Failures=0 Errors=0.

I believe Test case is not getting call....can anyone help me to get it run....

thanks...
venkat
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11945
Replace with
Your problem is that you're looking for the test classes with the template "${tst-dir}\Classes\${tst-dir}\Classes\*Test.class"...


Author of Test Driven (Manning Publications, 2007) [Blog] [HowToAskQuestionsOnJavaRanch]
 
 
subject: Help need Running JUnit Test cases from ANT
 
Threads others viewed
JUnit ant batch process failing
Testing using ANT
java.lang.classnotfoundexception in junit report
ant junitreport - producing html file with no test results
email junit test result
MyEclipse, The Clear Choice