Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums
-
generate a report with ANT
https://www.eclipse.org/forums/index.php/mv/msg/9843/30186/#msg_30186
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.]]>
Brice Laurel
2009-03-25T09:07:19-00:00
-
Re: generate a report with ANT
https://www.eclipse.org/forums/index.php/mv/msg/9843/30716/#msg_30716
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.]]>
Marc
2009-03-26T14:01:55-00:00