1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- this is a template file to test -->
3 <project name="testing-template" default="run" basedir=".">
4 <description>Builds the test against first version and runs them against two</description>
6 <loadproperties srcfile="project.properties"/>
8 <target name="make-sure-projects-are-compiled">
9 <ant dir="${dayA}/${apitotest}" target="compile"/>
10 <ant dir="${dayB}/${apitotest}" target="compile"/>
13 <target name="compile" depends="make-sure-projects-are-compiled">
14 <mkdir dir="build/tests"/>
15 <javac destdir="build/tests" srcdir="test">
17 <pathelement location="${apiA}"/>
18 <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
23 <target name="run" depends="-run-binary-check,-run-source-check">
24 <fail message="The test shall either compile against A and not B or run on A and fail on B, nothing like that happened">
27 <isset property="execution.failed"/>
28 <isset property="compilation.failed"/>
34 <target name="-run-binary-check" depends="compile">
35 <mkdir dir="build/testresultA"/>
36 <junit dir="build/tests" failureproperty="run.on.A.shall.succeed">
37 <batchtest todir="build/testresultA">
38 <fileset dir="test" includes="**/*.java"/>
40 <formatter type="brief" usefile="false"/>
41 <formatter type="xml"/>
43 <pathelement location="${apiA}"/>
44 <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
45 <pathelement location="build/tests"/>
49 <mkdir dir="build/testresultB"/>
50 <junit dir="build/tests" failureproperty="run.on.B.shall.fail">
51 <batchtest todir="build/testresultB">
52 <fileset dir="test" includes="**/*.java"/>
54 <formatter type="brief" usefile="false"/>
55 <formatter type="xml"/>
57 <pathelement location="${apiB}"/>
58 <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
59 <pathelement location="build/tests"/>
63 <condition property="execution.failed">
65 <isset property="run.on.B.shall.fail"/>
66 <not><isset property="run.on.A.shall.succeed"/></not>
71 <target name="-run-source-check" depends="compile" unless="execution.failed">
73 <property name="build.b" location="build/verifyitbuildsagainstB"/>
74 <delete dir="${build.b}"/>
75 <mkdir dir="${build.b}"/>
76 <javac destdir="${build.b}" srcdir="test" failonerror="false">
78 <pathelement location="${apiB}"/>
79 <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
84 <uptodate property="compilation.failed">
85 <srcfiles dir="${build.b}" includes="**/*.class"/>
86 <mapper type="glob" from="*" to="build/tests/*"/>
92 <target name="test" depends="run"/>