Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » generate a report with ANT
generate a report with ANT [message #30186] Wed, 25 March 2009 09:07 Go to next message
Brice Laurel is currently offline Brice LaurelFriend
Messages: 72
Registered: July 2009
Member
Hi list,

I have two applications:
- appli1 is a rcp application;
- appli2 is a plugin which tests appli1.

I want to generate a report of my test which ANT(task junit and junit
report). I read this page http://wiki.eclipse.org/SWTBot/Ant.
I have this build.xml but I don't know how I can modify it to do what I
want to do.


<project name="HelloWorld" basedir="." default="junit">

<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="main-class" value="oata.HelloWorld"/>
<property name="lib.dir" value="lib"/>
<property name="report.dir" value="${build.dir}/junit.report"/>

<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>

<target name="clean">
<delete dir="${build.dir}"/>
</target>

<target name="compile" depends="clean">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}"
classpathref="classpath"/>
</target>

<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar"
basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>

<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<classpath>
<path refid="classpath"/>
<path id="application"
location="${jar.dir}/${ant.project.name}.jar"/>
</classpath>
</java>
</target>

<target name="junit" depends="run">
<mkdir dir="${report.dir}"/>
<junit printsummary="yes" >
<classpath>
<path refid="classpath"/>
<path refid="application"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="${report.dir}">
<fileset dir="${src.dir}" includes="*Test.java"/>
</batchtest>
</junit>
</target>

<target name="junitreport">
<junitreport todir="${report.dir}">
<fileset dir="${report.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="./report/html"/>
</junitreport>
</target>

<target name="main" depends="run"/>

</project>


Thanks in advance for your help.
Re: generate a report with ANT [message #30716 is a reply to message #30186] Thu, 26 March 2009 14:01 Go to previous message
Marc is currently offline MarcFriend
Messages: 32
Registered: July 2009
Member
Have a look at this thread "Automating the launch of SWTBot tests with
Ant" on this news group.
I've just given an example of a target to test RCP.

In the build.xml you put, the run target ...

><target name="run" depends="jar">
> <java fork="true" classname="${main-class}">
> <classpath>
> <path refid="classpath"/>
> <path id="application"
> location="${jar.dir}/${ant.project.name}.jar"/>
> </classpath>
> </java>
> </target>

... lacks parameters.

Marc


Brice Laurel wrote:

> Hi list,

> I have two applications:
> - appli1 is a rcp application;
> - appli2 is a plugin which tests appli1.

> I want to generate a report of my test which ANT(task junit and junit
> report). I read this page http://wiki.eclipse.org/SWTBot/Ant.
> I have this build.xml but I don't know how I can modify it to do what I
> want to do.


> <project name="HelloWorld" basedir="." default="junit">

> <property name="src.dir" value="src"/>
> <property name="build.dir" value="build"/>
> <property name="classes.dir" value="${build.dir}/classes"/>
> <property name="jar.dir" value="${build.dir}/jar"/>
> <property name="main-class" value="oata.HelloWorld"/>
> <property name="lib.dir" value="lib"/>
> <property name="report.dir" value="${build.dir}/junit.report"/>

> <path id="classpath">
> <fileset dir="${lib.dir}" includes="**/*.jar"/>
> </path>

> <target name="clean">
> <delete dir="${build.dir}"/>
> </target>

> <target name="compile" depends="clean">
> <mkdir dir="${classes.dir}"/>
> <javac srcdir="${src.dir}" destdir="${classes.dir}"
> classpathref="classpath"/>
> </target>

> <target name="jar" depends="compile">
> <mkdir dir="${jar.dir}"/>
> <jar destfile="${jar.dir}/${ant.project.name}.jar"
> basedir="${classes.dir}">
> <manifest>
> <attribute name="Main-Class" value="${main-class}"/>
> </manifest>
> </jar>
> </target>

> <target name="run" depends="jar">
> <java fork="true" classname="${main-class}">
> <classpath>
> <path refid="classpath"/>
> <path id="application"
> location="${jar.dir}/${ant.project.name}.jar"/>
> </classpath>
> </java>
> </target>

> <target name="junit" depends="run">
> <mkdir dir="${report.dir}"/>
> <junit printsummary="yes" >
> <classpath>
> <path refid="classpath"/>
> <path refid="application"/>
> </classpath>
> <formatter type="xml"/>
> <batchtest fork="yes" todir="${report.dir}">
> <fileset dir="${src.dir}" includes="*Test.java"/>
> </batchtest>
> </junit>
> </target>

> <target name="junitreport">
> <junitreport todir="${report.dir}">
> <fileset dir="${report.dir}">
> <include name="TEST-*.xml"/>
> </fileset>
> <report format="frames" todir="./report/html"/>
> </junitreport>
> </target>

> <target name="main" depends="run"/>

> </project>


> Thanks in advance for your help.
Previous Topic:example (SWTBot and ANT)
Next Topic:Inconsistent API SWTBotMenu
Goto Forum:
  


Current Time: Fri Apr 19 02:23:59 GMT 2024

Powered by FUDForum. Page generated in 0.01979 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top