| <?xml version="1.0"?> |
| <!-- $Id$ --> |
| <project name="Tapestry Framework JUnit Test Suite" default="run"> |
| |
| <property name="root.dir" value="../"/> |
| |
| <property file="${root.dir}/config/Version.properties"/> |
| <property file="${root.dir}/config/build.properties"/> |
| <property file="${root.dir}/config/common.properties"/> |
| |
| |
| <property name="framework.src.dir" value="${root.dir}/framework/src"/> |
| <property name="clover-classes.dir" value=".clover-classes"/> |
| <property name="clover-db.dir" value=".clover-db"/> |
| <property name="clover.initstring" location="${clover-db.dir}/clover_db"/> |
| |
| <property name="clover.report.dir" value="../web/doc/clover"/> |
| |
| <property name="local.lib.dir" value="lib"/> |
| |
| <path id="compile-tests.classpath"> |
| <path refid="base.classpath"/> |
| <pathelement location="${root.lib.dir}/${framework.jar}"/> |
| </path> |
| |
| <path id="base.classpath"> |
| <fileset dir="${root.lib.dir}"> |
| <include name="${contrib.jar}"/> |
| <include name="${ext.dir}/*.jar"/> |
| <include name="${runtime.dir}/*.jar"/> |
| </fileset> |
| <fileset dir="${ext.dist.dir}"> |
| <include name="*.jar"/> |
| </fileset> |
| <pathelement location="${jython.dir}/jython.jar"/> |
| <fileset dir="${root.lib.dir}"> |
| <include name="${j2ee.dir}/*.jar"/> |
| </fileset> |
| </path> |
| |
| <target name="init"> |
| <mkdir dir="${classes.dir}"/> |
| </target> |
| |
| <target name="clean"> |
| <delete dir="${classes.dir}" quiet="true"/> |
| <delete dir="${clover-classes.dir}" quiet="true"/> |
| <delete dir="${clover-db.dir}" quiet="true"/> |
| <delete dir=".private" quiet="true"/> |
| </target> |
| |
| <target name="compile" depends="init" description="Compile all test classes."> |
| <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="on" target="1.1" source="1.3"> |
| <classpath refid="compile-tests.classpath"/> |
| </javac> |
| </target> |
| |
| <path id="junit.classpath"> |
| <path location="${classes.dir}"/> |
| <!-- Add the src directory back in, since package resources needed by |
| the tests are there. Also, ensure that the local copy |
| of junit/running/excluded.properties overrides the default |
| copy in junit.jar --> |
| <path location="${src.dir}"/> |
| <path refid="compile-tests.classpath"/> |
| </path> |
| |
| <target name="run" depends="compile" description="Run the test suite."> |
| <java fork="true" classname="junit.textui.TestRunner" |
| failonerror="false"> |
| <classpath refid="junit.classpath"/> |
| <arg value="org.apache.tapestry.junit.TapestrySuite"/> |
| <sysproperty key="org.apache.tapestry.enable-reset-service" value="true"/> |
| </java> |
| </target> |
| |
| <!-- To run just a single test case, specify -Dtestcase=name --> |
| |
| <target name="junit" depends="compile" description="Run the test suite."> |
| <junit printsummary="no" |
| errorProperty="test.failed" |
| failureProperty="test.failed" |
| fork="true"> |
| <classpath refid="junit.classpath"/> |
| <formatter type="xml"/> |
| <formatter type="brief" usefile="false"/> |
| |
| <sysproperty key="org.apache.tapestry.enable-reset-service" value="true"/> |
| |
| <batchtest todir="${classes.dir}" unless="testcase"> |
| <fileset dir="${classes.dir}" |
| includes="**/Test*.class" |
| excludes="**/*$$*.class" |
| /> |
| </batchtest> |
| |
| <batchtest todir="${classes.dir}" if="testcase"> |
| <fileset dir="${classes.dir}" |
| includes="**/${testcase}.class" |
| /> |
| </batchtest> |
| |
| </junit> |
| |
| <fail if="test.failed">Unit tests failed.</fail> |
| </target> |
| |
| <target name="junitreport"> |
| <junitreport todir="${classes.dir}"> |
| <fileset dir="${classes.dir}"> |
| <include name="TEST-*.xml"/> |
| </fileset> |
| <report format="frames" todir="${classes.dir}"/> |
| </junitreport> |
| </target> |
| |
| <target name="gui" depends="compile" description="Run the JUnit GUI."> |
| <java fork="true" classname="junit.swingui.TestRunner"> |
| <classpath refid="junit.classpath"/> |
| <arg value="org.apache.tapestry.junit.TapestrySuite"/> |
| <sysproperty key="org.apache.tapestry.enable-reset-service" value="true"/> |
| </java> |
| |
| </target> |
| |
| |
| <path id="clover.classpath"> |
| <pathelement location="${clover-classes.dir}"/> |
| <pathelement location="${clover.dir}/lib/clover.jar"/> |
| <path refid="junit.classpath"/> |
| </path> |
| |
| <target name="clover" description="Run the entire Tapestry test suite and construct the Clover report."> |
| <antcall target="run-clover"> |
| <param name="suite" value="org.apache.tapestry.junit.TapestrySuite"/> |
| </antcall> |
| </target> |
| |
| <target name="fast-clover" description="Run a subset of the Tapestry test suite (excluding mock unit tests), and construct the Clover report."> |
| <antcall target="run-clover"> |
| <param name="suite" value="org.apache.tapestry.junit.BasicTestSuite"/> |
| </antcall> |
| </target> |
| |
| <target name="run-clover" depends="compile" description="Run tests and construct the Clover report."> |
| <mkdir dir="${clover-classes.dir}"/> |
| <mkdir dir="${clover-db.dir}"/> |
| |
| <property name="build.compiler" |
| value="org.apache.tools.ant.taskdefs.CloverCompilerAdapter"/> |
| |
| <javac srcdir="${framework.src.dir}" destdir="${clover-classes.dir}" debug="on" target="1.1"> |
| <classpath refid="base.classpath"/> |
| </javac> |
| |
| <echo>Executing suite ${suite} ...</echo> |
| |
| <echo>Clover Run #1: No logging enabled ...</echo> |
| |
| <java fork="true" classname="junit.textui.TestRunner" |
| failonerror="true"> |
| <classpath refid="clover.classpath"/> |
| <arg value="${suite}"/> |
| <sysproperty key="org.apache.tapestry.enable-reset-service" value="true"/> |
| </java> |
| |
| |
| <echo>Clover Run #2: All logging enabled ...</echo> |
| |
| <java fork="true" classname="junit.textui.TestRunner" |
| failonerror="true"> |
| <classpath refid="clover.classpath"/> |
| <arg value="${suite}"/> |
| <sysproperty key="log4j.configuration" value="log4j-slow.properties"/> |
| <sysproperty key="org.apache.tapestry.enable-reset-service" value="true"/> |
| </java> |
| |
| <antcall target="clover-report"/> |
| </target> |
| |
| <target name="clover-report"> |
| <mkdir dir="${clover.report.dir}"/> |
| |
| <java |
| classname="com.cortexeb.tools.clover.reporters.html.HtmlReporter" |
| fork="true"> |
| <classpath> |
| <pathelement location="${clover.dir}/lib/clover.jar"/> |
| <pathelement location="${clover.dir}/lib/velocity.jar"/> |
| </classpath> |
| <arg line="--outputdir ${clover.report.dir}"/> |
| <arg line="--showSrc"/> |
| <arg line="--initstring ${clover.initstring}"/> |
| <arg line="--title 'Release ${framework.version}'"/> |
| </java> |
| |
| </target> |
| |
| </project> |
| |