antlets/junit/src xbuild.xml,NONE,1.1 tasks.properties,NONE,1.1
[email protected] Thu, 26 Feb 2004 09:11:14 -0800
| Newsgroups | gmane.comp.krysalis.metamorphosis.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/metamorphosis/antlets/junit/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6683/junit/src
Added Files:
xbuild.xml tasks.properties
Log Message:
Added junit antlet
--- NEW FILE: xbuild.xml ---
<?xml version="1.0"?>
<project default="test" name="junit.antlet">
<description>
Perform the unit tests using JUnit, and generates reports.
</description>
<!-- =================================================================== -->
<!-- ================ Properties for this antlet ===================== -->
<!-- =================================================================== -->
<dirname property="junit.antlet.dir" file="${ant.file.junit.antlet}"/>
<property name="junit.antlet.build.dir" value="${project.build.dir}/junit"/>
<property name="junit.repository" value="http://www.ibiblio.org/maven/junit/jars/"/>
<property name="junit.jar" value="junit-3.8.1.jar"/>
<property name="junit.antlet.docs.dir" value="${build.dir}/documentation/content/junit"/>
<property name="junit.antlet.build.dir.passdown" value="${junit.antlet.build.dir}"/>
<property name="junit.antlet.work.dir" value="${work.dir}/junit"/>
<property name="project.test.dir" value="${basedir}/src/test"/>
<target name="-junit.init">
<mkdir dir="${junit.antlet.build.dir}"/>
<mkdir dir="${junit.antlet.work.dir}"/>
<mkdir dir="${junit.antlet.dir}/lib"/>
<get
src="${junit.repository}${junit.jar}"
dest="${junit.antlet.dir}/lib/${junit.jar}"
verbose="true" usetimestamp="true"/>
<!-- Classpath for my jars -->
<path id="junit.classpath">
<fileset dir="${junit.antlet.dir}/lib/">
<include name="*.jar"/>
</fileset>
</path>
<taskdef file="${junit.antlet.dir}/tasks.properties" classpathref="junit.classpath"/>
</target>
<property name="project.test.dir"
value="${jxpath:/references/module.xml/root/module/project[@name=$project.name]/test[@type='test/junit']/@dir}"/>
<!-- =================================================================== -->
<!-- ==================== user info for this antlet ==================== -->
<!-- =================================================================== -->
<!-- TODO convert and change xdocs for manual -->
<target name="junit-userinfo" description="user info for this antlet">
<echo>
jUnit antlet uses output dir : ${junit.antlet.build.dir}
</echo>
</target>
<!-- =================================================================== -->
<!-- ================ List of possible tasks for this antlet =========== -->
<!-- =================================================================== -->
<!-- TODO find out how to print a list of targets with jxpath -->
<target name="junit-list" description="List of possible tasks for this antlet">
<echo>
------------------------------------------------------------------
-------- List of possible targets for junit antlet ----------
------------------------------------------------------------------
- junit-list - Print this list
- junit-compile - Compile the test sources
- junit-test - Perform jUnit tests
- junit-failsafe-test - no failing for report generation
- junit-report - Perform jUnit test reports
------------------------------------------------------------------
</echo>
</target>
<!-- =================================================================== -->
<!-- ================ Checks jUnit antlet settings ===================== -->
<!-- =================================================================== -->
<target name="junit-check" description="Checks jUnit antlet settings">
<echo>
antlets.dir ${antlets.dir}
project.test.dir ${project.test.dir}
junit.antlet.dir ${junit.antlet.dir}
junit.antlet.build.dir ${junit.antlet.build.dir}
junit.antlet.docs.dir ${junit.antlet.docs.dir}
junit.antlet.work.dir ${junit.antlet.work.dir}
build.compiler.debug ${build.compiler.debug}
build.compiler.optimize ${build.compiler.optimize}
build.compiler.vm ${build.compiler.vm}
basedir ${basedir}
${jxpath:/xbuild.xml/root/../target}
</echo>
</target>
<!-- =================================================================== -->
<target name="junit-failsafe-test" description="Perform jUnit tests without failing; important to make it possible to generate a report on the failings">
<property name="junit.test.haltonfailure" value="no"/>
<antcall target="junit-test"/>
</target>
<target name="junit-compile" description="Compile tests">
<!-- Compile tests -->
<mkdir dir="${junit.antlet.build.dir}/classes"/>
<copy todir="${junit.antlet.build.dir}/classes">
<fileset dir="${project.test.dir}">
<exclude name="**/*.java"/> <!-- was include *.properties -->
</fileset>
</copy>
<javac srcdir="${project.test.dir}"
destdir="${junit.antlet.build.dir}/classes"
debug= "${build.compiler.debug}"
optimize= "${build.compiler.optimize}"
deprecation="${build.compiler.deprecation}"
target= "${build.compiler.vm}"
source= "${build.compiler.source}"
nowarn= "false">
<classpath>
<pathelement location="${project.build.dir}/classes/" />
<path refid="${project.name}.classpath"/>
<path refid="junit.classpath"/>
</classpath>
</javac>
</target>
<!-- Initialize for testing. -->
<target name="junit-test-init" description="Initialize for testing">
<property name="junit.test.haltonfailure" value="yes"/>
<echo message="Testing..."/>
<mkdir dir="${junit.antlet.build.dir}/results"/>
</target>
<!-- Perform jUnit tests. Add the junit.antlet.extra.sysproperty elements in
properties.xml to add sys properties. -->
<target name="junit-test"
description="Perform jUnit tests. Add the junit.antlet.extra.sysproperty
elements in properties.xml to add sys properties."
depends="-junit.init, compile, junit-compile, junit-test-init">
<property name="testcase" value=""/>
<!-- create property file to be used by junit antlet -->
<xslt in="properties.xml" out="${junit.antlet.work.dir}/test.xml"
style="${junit.antlet.dir}/resources/stylesheets/test.xsl"
force="true">
<param name="testcase" expression="${testcase}"/>
<param name="projectName" expression="${project.name}"/>
</xslt>
<ant antfile="${junit.antlet.work.dir}/test.xml" inheritRefs="true"/>
</target>
<!-- =================================================================== -->
<!-- Test reports -->
<!-- =================================================================== -->
<target name="junit-report" description="Perform jUnit test reports" depends="junit-failsafe-test">
<mkdir dir="${junit.antlet.docs.dir}"/>
<mkdir dir="${junit.antlet.work.dir}"/>
<junitreport todir="${junit.antlet.work.dir}">
<fileset dir="${junit.antlet.build.dir}/results">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.antlet.docs.dir}"/>
</junitreport>
</target>
</project>
--- NEW FILE: tasks.properties ---
#junit tasks
junit=org.apache.tools.ant.taskdefs.optional.junit.JUnitTask
junitreport=org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click