ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phani Kumar" <phani...@gmail.com>
Subject JUnit Report (Please help me, i am trying this from past two weeks)
Date Fri, 12 Dec 2008 09:10:03 GMT
Hi,

I am trying to generate html report through ant build.xml file, in that
process i am able to run my test successfully but it fails to generate html
report and it giving me error "java.lang.NoSuchMe
thodError:org.apache.tools. ant.types. resources. Resources.
dieOnCircularRef erence()V"

i am giving my build.xml file below.. please let me know where did i went
wrong..and with what changes it works successfully

I am using apache-ant-1.7.1, and did not find optinal.jar in ant\lib, could
you please let me know what is the replacement of optional.jar file in
ant-1.7.1

<project name="MyProject" default="report" basedir=".">
  <description> simple example build file </description>
  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="reports" location="reports"/>
  <property name="html" location="${reports}/html"/>
  <property name="jreports" location="${reports}/jreports"/>

    <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    <mkdir dir="${src}"/>
    <mkdir dir="${reports}"/>
    <mkdir dir="${reports}/html"/>
    <mkdir dir="${reports}/jreports"/>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>
  </target>

<target name="test" depends="compile"
        description="runs all junit test cases" >
<!-- Runs .class files from ${build} -->
    <junit printsummary="yes" haltonfailure="yes">
  <classpath>
    <pathelement location="${build}"/>
    <pathelement path="${c:\junit4.5\junit-4.5.jar}"/>
  </classpath>
  <formatter type="plain" usefile="false"/>
   <test name="NewTest" haltonfailure="no" outfile="result"
todir="${reports}">
    <formatter type="xml"/>
  </test>

   <!-- <batchtest fork="yes" todir="${build}">
    <fileset dir="${build}">
      <include name="*Test.class"/>
   <exclude name="**/AllTests.class"/>
     </fileset>
  </batchtest> -->

</junit>
</target>

<target name="report" depends="test"
        description="Generates JUnit HTML report" >
<!-- <taskdef name="myjars" classname=".\build.xml">
  <classpath>
        <pathelement path="${C:\apache-ant-1.7.1\lib\junit-4.5.jar}"/>
        <pathelement path="${C:\apache-ant-1.7.1\lib\ant-junit.jar}"/>
  </classpath>
</taskdef> -->
        <junitreport todir="${reports}">
        <fileset dir="${reports}">
            <include name="*Test-*.xml"/>
        </fileset>
      <report todir="${html}"/>
    </junitreport>
    </target>


  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>



Thanks,
Venkata Phani

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message