You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Phani Kumar <ph...@gmail.com> on 2008/12/12 10:10:03 UTC

JUnit Report (Please help me, i am trying this from past two weeks)

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

Re: JUnit Report (Please help me, i am trying this from past two weeks)

Posted by Prashant Reddy <pr...@pramati.com>.
Phani Kumar wrote:
> I removed <pathelement path="${c:\junit4.5\junit-4.5.jar}"/> from <JUnit>
> target and test runs fine, i got result.xml file .. but could not able to
> get the reports.. is there anything wrong in this report Target code?
> i have put the jar file outside of Ant\lib still getting same result
> i am using jdk 15 and Ant 1.7, installed xalan also
>   

Try using JDK 1.6. Run ant -diagnostics after this to make sure ant 
picking 1.6 version and that Xalan implementation is also picked from 
Sun JDK.
> below is the result of my build.xml also u can find the latest build.xml
>
> C:\Test1>ant -f build.xml
> Buildfile: build.xml
>
> init:
>     [mkdir] Created dir: C:\Test1\build
>     [mkdir] Created dir: C:\Test1\reports
>     [mkdir] Created dir: C:\Test1\reports\html
>
> compile:
>     [javac] Compiling 1 source file to C:\Test1\build
>
> test:
>     [junit] Running NewTest
>     [junit] Testsuite: NewTest
>     [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 67.229 sec
>     [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 67.229 sec
>
>     [junit] Testcase: testNew took 66.468 sec
>
> report:
>
> BUILD FAILED
> java.lang.NoSuchMethodError:
> org.apache.tools.ant.taskdefs.TempFile.bindToOwner(Lorg/apache/tools/ant/Task;)V
>
> Total time: 1 minute 25 seconds
> C:\Test1>
>
> build.xml
> ======
>
> <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"/>
>
>     <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"/>
>   </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}"/>
>   </classpath>
>   <formatter type="plain" usefile="false"/>
>    <test name="NewTest" haltonfailure="no" outfile="result"
> todir="${reports}">
>     <formatter type="xml"/>
>   </test>
> </junit>
> </target>
>
> <target name="report" depends="test"
>         description="Generates JUnit HTML report" >
>         <junitreport todir="${reports}">
>         <fileset dir="${reports}">
>             <include name="*Test-*.xml"/>
>         </fileset>
>       <!-- <report format="frames" todir="${html}"/> -->
>       <report format="noframes"
> styledir="org\apache\tools\ant\taskdefs\optional\junit\xsl"/>
>     </junitreport>
>     </target>
>
>
>   <target name="clean"
>         description="clean up" >
>     <!-- Delete the ${build} and ${dist} directory trees -->
>     <delete dir="${build}"/>
>     <delete dir="${dist}"/>
>   </target>
> </project>
>
>
> On Fri, Dec 12, 2008 at 4:25 PM, Mark Salter <ma...@talktalk.net>wrote:
>
>   
>> Phani Kumar wrote:
>>
>>     
>>> 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"
>>>       
>> This looks to me that you have a circular reference somewhere in your
>> processing.
>>     
>>> i am giving my build.xml file below.. please let me know where did i went
>>> wrong..and with what changes it works successfully
>>>       
>> Which task is failing please?
>>
>>     
>>>     <pathelement path="${c:\junit4.5\junit-4.5.jar}"/>
>>>       
>> Using ${ to indicate a variable when an absolute path is given looks
>> very odd to me, but could it cause this problem?
>>
>> So more people can consider helping...
>>
>> ...Could you post:-
>> - the full stack trace (copy/paste),
>> - any messages issued by ant - there must be some?
>>
>>
>> Also take a look at the verbose output from ant -verbose, you might find
>> something useful there.
>>
>> You might also - if you have a spare second - take a quick look at :-
>>
>>        www.catb.org/~esr/faqs/smart-questions.html<http://www.catb.org/%7Eesr/faqs/smart-questions.html>
>>
>> As you have already spent time on this over the last two weeks, it is
>> probably worth spending a bit more so you can pose a smart question,
>> which may in turn get you the answer you need.
>>
>> --
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>     
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: JUnit Report (Please help me, i am trying this from past two weeks)

Posted by Mark Salter <ma...@talktalk.net>.
Phani Kumar wrote:
> this is the result of ant verbose
Now all you had to do was read the output, as far as...

> 
> C:\test1>ant -verbose
> Apache Ant version 1.6.5 compiled on June 2 2005

...the first line of output.

It appears you have an older version of ant on your PATH.  Track this
down and eliminate it in favour of the 1.7.x version you thought you
were running, then perhaps things will get better.


-- 
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: JUnit Report (Please help me, i am trying this from past two weeks)

Posted by Phani Kumar <ph...@gmail.com>.
this is the result of ant verbose

C:\test1>ant -verbose
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.5 in: C:\Program Files\Java\jdk1.5.0_16\jre
Detected OS: Windows XP
parsing buildfile C:\test1\build.xml with URI = file:///C:/test1/build.xml
Project base dir set to: C:\test1
Build sequence for target(s) `report' is [init, compile, test, report]
Complete build sequence is [init, compile, test, report, clean, ]

init:

compile:
    [javac] NewTest.java omitted as NewTest.class is up to date.

test:
    [junit] Using System properties {java.runtime.name=Java(TM) 2 Runtime
Environment, Standard Edition, sun.boot.library.path=C:\Program
Files\Java\jdk1.5.0_16\jre\bin, java.vm.version=1.5.0_16
    [junit] , java.vm.specification.vendor=Sun Microsystems Inc.,
user.variant=, os.name=Windows XP, ant.home=c:\apache-ant-1.7.1,
sun.jnu.encoding=Cp1252, java.library.path=C:\Program Files\Jav
e-control-0.9.2\selenium-java-client-driver-0.9.2\selenium-java-client-driver.jar;c:\apache-ant-1.7.1\lib\;C:\junit4.5\junit-4.5.jar;C:\apache-maven-2.0.9\lib\maven-2.0.9-uber.jar;C:\Program
Fil
-1.7.1\lib\ant-trax.jar;C:\apache-ant-1.7.1\lib\ant-weblogic.jar;C:\apache-ant-1.7.1\lib\ant.jar;C:\apache-ant-1.7.1\lib\junit-4.5.jar;C:\apache-ant-1.7.1\lib\serializer.jar;C:\apache-ant-1.7.1\
ugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little,
sun.desktop=windows, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx
pentium i486 i386 i86}
    [junit] Implicitly adding
C:\selenium-remote-control-0.9.2\selenium-server-0.9.2\selenium-server.jar;C:\apache-ant-1.7.1\lib\ant-launcher.jar;C:\apache-ant-1.7.1\lib\ant-junit.jar
to CLASSPA
    [junit] Using CLASSPATH
C:\test1\build;C:\selenium-remote-control-0.9.2\selenium-server-0.9.2\selenium-server.jar;C:\apache-ant-1.7.1\lib\ant-launcher.jar;C:\apache-ant-1.7.1\lib\ant-junit.j
    [junit] Running NewTest
    [junit] Testsuite: NewTest
    [junit] junit.framework.TestListener: tests to run: 1
    [junit] junit.framework.TestListener: startTest(testNew)
    [junit] junit.framework.TestListener: endTest(testNew)
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 32.406 sec
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 32.406 sec

    [junit] Testcase: testNew took 31.836 sec

report:

BUILD FAILED
java.lang.NoSuchMethodError:
org.apache.tools.ant.taskdefs.TempFile.bindToOwner(Lorg/apache/tools/ant/Task;)V
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1225)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.NoSuchMethodError:
org.apache.tools.ant.taskdefs.TempFile.bindToOwner(Lorg/apache/tools/ant/Task;)V
        at
org.apache.tools.ant.taskdefs.optional.junit.AggregateTransformer.transform(AggregateTransformer.java:229)
        at
org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator.execute(XMLResultAggregator.java:158)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        ... 7 more
--- Nested Exception ---
java.lang.NoSuchMethodError:
org.apache.tools.ant.taskdefs.TempFile.bindToOwner(Lorg/apache/tools/ant/Task;)V
        at
org.apache.tools.ant.taskdefs.optional.junit.AggregateTransformer.transform(AggregateTransformer.java:229)
        at
org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator.execute(XMLResultAggregator.java:158)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 38 seconds



On Fri, Dec 12, 2008 at 9:10 PM, Mark Salter <ma...@talktalk.net>wrote:

> Phani Kumar wrote:
>
> > report:
> >
> > BUILD FAILED
> > java.lang.NoSuchMethodError:
> >
> org.apache.tools.ant.taskdefs.TempFile.bindToOwner(Lorg/apache/tools/ant/Task;)V
> >
> Ok, you seem to have moved on?
> Can you please check you are using ant 1.7 (ant -verbose) please?
>
> This method is commented as added in 1.7 and should therefore be present
> for you?
>
> I also see you producing a file called result[.xml] from the test, but
> not using it in the junitreport, but I think the 'missing'
> Task.bindToOwner(Task) method indicates a bigger problem with your
> environment.
>
> --
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: JUnit Report (Please help me, i am trying this from past two weeks)

Posted by Mark Salter <ma...@talktalk.net>.
Phani Kumar wrote:

> report:
> 
> BUILD FAILED
> java.lang.NoSuchMethodError:
> org.apache.tools.ant.taskdefs.TempFile.bindToOwner(Lorg/apache/tools/ant/Task;)V
> 
Ok, you seem to have moved on?
Can you please check you are using ant 1.7 (ant -verbose) please?

This method is commented as added in 1.7 and should therefore be present
for you?

I also see you producing a file called result[.xml] from the test, but
not using it in the junitreport, but I think the 'missing'
Task.bindToOwner(Task) method indicates a bigger problem with your
environment.

-- 
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: JUnit Report (Please help me, i am trying this from past two weeks)

Posted by Phani Kumar <ph...@gmail.com>.
I removed <pathelement path="${c:\junit4.5\junit-4.5.jar}"/> from <JUnit>
target and test runs fine, i got result.xml file .. but could not able to
get the reports.. is there anything wrong in this report Target code?
i have put the jar file outside of Ant\lib still getting same result
i am using jdk 15 and Ant 1.7, installed xalan also

below is the result of my build.xml also u can find the latest build.xml

C:\Test1>ant -f build.xml
Buildfile: build.xml

init:
    [mkdir] Created dir: C:\Test1\build
    [mkdir] Created dir: C:\Test1\reports
    [mkdir] Created dir: C:\Test1\reports\html

compile:
    [javac] Compiling 1 source file to C:\Test1\build

test:
    [junit] Running NewTest
    [junit] Testsuite: NewTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 67.229 sec
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 67.229 sec

    [junit] Testcase: testNew took 66.468 sec

report:

BUILD FAILED
java.lang.NoSuchMethodError:
org.apache.tools.ant.taskdefs.TempFile.bindToOwner(Lorg/apache/tools/ant/Task;)V

Total time: 1 minute 25 seconds
C:\Test1>

build.xml
======

<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"/>

    <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"/>
  </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}"/>
  </classpath>
  <formatter type="plain" usefile="false"/>
   <test name="NewTest" haltonfailure="no" outfile="result"
todir="${reports}">
    <formatter type="xml"/>
  </test>
</junit>
</target>

<target name="report" depends="test"
        description="Generates JUnit HTML report" >
        <junitreport todir="${reports}">
        <fileset dir="${reports}">
            <include name="*Test-*.xml"/>
        </fileset>
      <!-- <report format="frames" todir="${html}"/> -->
      <report format="noframes"
styledir="org\apache\tools\ant\taskdefs\optional\junit\xsl"/>
    </junitreport>
    </target>


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


On Fri, Dec 12, 2008 at 4:25 PM, Mark Salter <ma...@talktalk.net>wrote:

> Phani Kumar wrote:
>
> > 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"
>
> This looks to me that you have a circular reference somewhere in your
> processing.
> >
> > i am giving my build.xml file below.. please let me know where did i went
> > wrong..and with what changes it works successfully
>
> Which task is failing please?
>
> >     <pathelement path="${c:\junit4.5\junit-4.5.jar}"/>
>
> Using ${ to indicate a variable when an absolute path is given looks
> very odd to me, but could it cause this problem?
>
> So more people can consider helping...
>
> ...Could you post:-
> - the full stack trace (copy/paste),
> - any messages issued by ant - there must be some?
>
>
> Also take a look at the verbose output from ant -verbose, you might find
> something useful there.
>
> You might also - if you have a spare second - take a quick look at :-
>
>        www.catb.org/~esr/faqs/smart-questions.html<http://www.catb.org/%7Eesr/faqs/smart-questions.html>
>
> As you have already spent time on this over the last two weeks, it is
> probably worth spending a bit more so you can pose a smart question,
> which may in turn get you the answer you need.
>
> --
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
Regards,
Phani Annadanam
ఫణి కుమార్ అన్నదానం
फणि कुमार अन्नदानम

Re: JUnit Report (Please help me, i am trying this from past two weeks)

Posted by Mark Salter <ma...@talktalk.net>.
Phani Kumar wrote:

> 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"

This looks to me that you have a circular reference somewhere in your
processing.
> 
> i am giving my build.xml file below.. please let me know where did i went
> wrong..and with what changes it works successfully

Which task is failing please?

>     <pathelement path="${c:\junit4.5\junit-4.5.jar}"/>

Using ${ to indicate a variable when an absolute path is given looks
very odd to me, but could it cause this problem?

So more people can consider helping...

...Could you post:-
- the full stack trace (copy/paste),
- any messages issued by ant - there must be some?


Also take a look at the verbose output from ant -verbose, you might find
something useful there.

You might also - if you have a spare second - take a quick look at :-

	www.catb.org/~esr/faqs/smart-questions.html

As you have already spent time on this over the last two weeks, it is
probably worth spending a bit more so you can pose a smart question,
which may in turn get you the answer you need.	

-- 
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: JUnit Report (Please help me, i am trying this from past two weeks)

Posted by Prashant Reddy <pr...@pramati.com>.
How about :

1. Rename xalan.jar from ANT/lib (Rename to something like xalan.jar1)
2. Run ANT with JDK 1.6 set in the path.

My guess is that the Xalan that ANT ships is giving you problem, and by 
following the above steps Xalan shipped with Sun JDK will be picked up.

But obviously this solution is not scalable, if you want your build.xml 
to run on other machines..

-Prashant

Phani Kumar wrote:
> 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
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org