samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/build.xml
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:52:48 +0200
changeset 54 45b0d58e66ca
child 58 be49ca0fff33
permissions -rw-r--r--
Getting the solutions from the CVS, not just from the ZIP file
     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>
     5     
     6     <loadproperties srcfile="project.properties"/>
     7     
     8     <target name="make-sure-projects-are-compiled">
     9         <ant dir="${dayA}/${apitotest}" target="compile"/>
    10         <ant dir="${dayB}/${apitotest}" target="compile"/>
    11     </target>
    12     
    13     <target name="compile" depends="make-sure-projects-are-compiled">
    14         <mkdir dir="build/tests"/>
    15         <javac destdir="build/tests" srcdir="test">
    16             <classpath>
    17                 <pathelement location="${apiA}"/>
    18                 <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
    19             </classpath>
    20         </javac>
    21     </target>
    22     
    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">
    25             <condition>
    26                 <not><or>
    27                     <isset property="execution.failed"/>
    28                     <isset property="compilation.failed"/>
    29                 </or></not>
    30             </condition>
    31         </fail>
    32     </target>
    33         
    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"/>
    39             </batchtest>
    40             <formatter type="brief" usefile="false"/>
    41             <formatter type="xml"/>
    42             <classpath>
    43                 <pathelement location="${apiA}"/>
    44                 <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
    45                 <pathelement location="build/tests"/>
    46             </classpath>
    47         </junit>
    48         
    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"/>
    53             </batchtest>
    54             <formatter type="brief" usefile="false"/>
    55             <formatter type="xml"/>
    56             <classpath>
    57                 <pathelement location="${apiB}"/>
    58                 <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
    59                 <pathelement location="build/tests"/>
    60             </classpath>
    61         </junit>
    62         
    63         <condition property="execution.failed">
    64             <and>
    65                 <isset property="run.on.B.shall.fail"/>
    66                 <not><isset property="run.on.A.shall.succeed"/></not>
    67             </and>
    68         </condition>
    69     </target>
    70     
    71     <target name="-run-source-check" depends="compile" unless="execution.failed">
    72         
    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">
    77             <classpath>
    78                 <pathelement location="${apiB}"/>
    79                 <pathelement location="${apifest}/lib/junit-3.8.2.jar"/>
    80             </classpath>
    81         </javac>
    82 
    83         
    84         <uptodate property="compilation.failed">
    85             <srcfiles dir="${build.b}" includes="**/*.class"/>
    86             <mapper type="glob" from="*" to="build/tests/*"/>
    87         </uptodate>
    88         
    89 
    90     </target>
    91     
    92     <target name="test" depends="run"/>
    93     
    94     <target name="clean">
    95         <delete dir="build"/>
    96     </target>
    97 </project>