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 <echo level="info" message="Compiling the tests against old version of the API"/>
16 <javac destdir="build/tests" srcdir="test">
18 <pathelement location="${apiA}"/>
19 <pathelement location="${junit.jar}"/>
24 <target name="run" depends="-run-binary-check,-run-source-check">
25 <fail message="The test shall either compile against A and not B or run on A and fail on B, nothing like that happened">
28 <isset property="execution.failed"/>
29 <isset property="compilation.failed"/>
35 <target name="-run-binary-check" depends="compile">
36 <mkdir dir="build/testresultA"/>
38 <echo level="info" message="Running the tests against old version of the API"/>
39 <junit dir="build/tests" failureproperty="run.on.A.shall.succeed" fork="true">
40 <batchtest todir="build/testresultA">
41 <fileset dir="test" includes="**/*.java"/>
43 <formatter type="brief" usefile="false"/>
44 <formatter type="xml"/>
46 <pathelement location="${apiA}"/>
47 <pathelement location="${junit.jar}"/>
48 <pathelement location="build/tests"/>
52 <mkdir dir="build/testresultB"/>
53 <echo level="info" message="Running the same tests against new version of the API, this should fail, if there is binary or functional incompatibility"/>
54 <junit dir="build/tests" failureproperty="run.on.B.shall.fail" fork="true">
55 <batchtest todir="build/testresultB">
56 <fileset dir="test" includes="**/*.java"/>
58 <formatter type="brief" usefile="false"/>
59 <formatter type="xml"/>
61 <pathelement location="${apiB}"/>
62 <pathelement location="${junit.jar}"/>
63 <pathelement location="build/tests"/>
67 <condition property="execution.failed">
69 <isset property="run.on.B.shall.fail"/>
70 <not><isset property="run.on.A.shall.succeed"/></not>
75 <target name="-run-source-check" depends="compile" unless="execution.failed">
77 <property name="build.b" location="build/verifyitbuildsagainstB"/>
78 <delete dir="${build.b}"/>
79 <mkdir dir="${build.b}"/>
82 <echo level="info" message="Verifying source compatibility: Compiling the tests against new version of the API"/>
83 <javac destdir="${build.b}" srcdir="test" failonerror="false" fork="true">
85 <pathelement location="${apiB}"/>
86 <pathelement location="${junit.jar}"/>
91 <uptodate property="compilation.failed">
92 <srcfiles dir="${build.b}" includes="**/*.class"/>
93 <mapper type="glob" from="*" to="build/tests/*"/>
99 <target name="test" depends="run"/>
101 <target name="clean">
102 <delete dir="build"/>