Running the Testcases using ANT script
ANT provides the task to run the JUnit test cases
For using this task we need to have junit.jar file in classpath instead we can copy that jar file into our ANT_HOME\lib folder
below i have given a sample example to run the junit test cases
<junit printsummary="no" haltonfailure="no">
<jvmarg value="-classic"/>
<classpath>
<pathelement path="${app.classpath}" />
<pathelement path="${app.build-test}" />
<pathelement path="${app.build-classes}" />
</classpath>
<formatter type="xml" usefile="true" />
<batchtest>
<fileset dir="${app.build-test}">
<include name="**/test/beans/XML*Test.class" />
<!-- sandbox -->
</fileset>
</batchtest>
</junit>
to understan more about this junit task u can go throug the below link
More help on Junit Ant Task
we can use the junitreport task to generate the report for the junit testcases after running the junit task we can get the xml files
if we use this task after junit we can have a HTML junit task reports which looks like java doc with all the information i.e
tests runned
failures
errors
etc......
Below is a sample code for the junitreport task
<junitreport todir=".">
<fileset dir=".">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${app.build-test-report}/html"/>
</junitreport>
to understan more about this junitreport task u can go throug the below link
More help on junitreport Ant Task
to run the junitreport we need to put the xalan.jar in the classpath otherwise we can copy this in to ANT_HOME\lib
Note:if You are using xalan2.7.0 then we need to copy serializer.jar and xsltc.jar along with the xalan.jar
For using this task we need to have junit.jar file in classpath instead we can copy that jar file into our ANT_HOME\lib folder
below i have given a sample example to run the junit test cases
<junit printsummary="no" haltonfailure="no">
<jvmarg value="-classic"/>
<classpath>
<pathelement path="${app.classpath}" />
<pathelement path="${app.build-test}" />
<pathelement path="${app.build-classes}" />
</classpath>
<formatter type="xml" usefile="true" />
<batchtest>
<fileset dir="${app.build-test}">
<include name="**/test/beans/XML*Test.class" />
<!-- sandbox -->
</fileset>
</batchtest>
</junit>
to understan more about this junit task u can go throug the below link
More help on Junit Ant Task
we can use the junitreport task to generate the report for the junit testcases after running the junit task we can get the xml files
if we use this task after junit we can have a HTML junit task reports which looks like java doc with all the information i.e
tests runned
failures
errors
etc......
Below is a sample code for the junitreport task
<junitreport todir=".">
<fileset dir=".">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${app.build-test-report}/html"/>
</junitreport>
to understan more about this junitreport task u can go throug the below link
More help on junitreport Ant Task
to run the junitreport we need to put the xalan.jar in the classpath otherwise we can copy this in to ANT_HOME\lib
Note:if You are using xalan2.7.0 then we need to copy serializer.jar and xsltc.jar along with the xalan.jar
