Project

General

Profile

2 krennw
<?xml version="1.0" encoding="UTF-8"?>

<project name="MoMuT Test" default="buildTests" basedir=".">
<!-- The directory containing the executable MoMuT jar file -->
<property name="momutDir" value="../momut/MoMuT" />
<!-- The name of the destination .jar file copied from the MoMuT project. -->
<property name="momutJar" value="MoMuT.jar" />
<property name="libs" value="lib" />
<property name="src" value="src" />
<property name="bin" value="bin" />
<property name="build.number" value="default" />
<property name="reports.dir" value="reports" />
<property name="reports" value="${reports.dir}/build-${build.number}" />
<property name="temp.dir" value="temp" />
<property name="momut.temp.dir" value="${temp.dir}/build-${build.number}" />

<path id="classpath">
<fileset dir="${libs}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${bin}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${bin}" />
</path>

<!-- Target to initialize common resources (e.g. create directories, timestamps, etc.) -->
<target name="init" description="Initialize build process">
<echo>Initilize build process...</echo>
<echo>MoMuT temp directory set to ${momut.temp.dir}</echo>
<mkdir dir="${bin}" />
<mkdir dir="${reports}" />
<mkdir dir="${temp.dir}" />

<!-- Copy the .jar file of the MoMuT project into current workspaces ${lib} directory. -->
<copy tofile="${libs}/${momutJar}" overwrite="yes">
<fileset dir="${momutDir}" includes="*.jar"/>
</copy>
</target>

<!-- Target to build all the junit test environment -->
<target name="buildTests" depends="init" description="Build the java test classes">
<javac srcdir="${src}" destdir="${bin}" debug="false" deprecation="true" optimize="true" includeantruntime="false">
<classpath refid="classpath"/>
</javac>
<copyResources/>
</target>

<!-- Target to execute all UML2OOAS test -->
<target name="testUml2OoasSuite" depends="buildTests" description="Run all UML2OOAS tests as suite">
<echo>Running Uml2Ooas tests (working directory: ${basedir})</echo>
<mkdir dir="${reports}/uml2ooas/" />
<junit haltonfailure="no" printsummary="yes" showoutput="true">
<classpath refid="classpath"/>
<!-- Avoid using showoutput="true" and formatters..?. -->
<!-- <formatter type="plain" /> to screen -->
<formatter type="xml" /> <!-- to file -->
<batchtest fork="true" todir="${reports}/uml2ooas/">
<fileset dir="${src}">
<include name="**/uml2ooas/AllUml2OoasTests.java" />
</fileset>
</batchtest>
<jvmarg value="-Dmomut.temp.dir=${momut.temp.dir}"/>
</junit>
</target>

<!-- Target to execute all tests -->
<target name="testAllSuite" depends="buildTests" description="Run all tests as suite">
<mkdir dir="${reports}/all/" />
<junit haltonfailure="no" printsummary="yes" showoutput="true">
<classpath refid="classpath"/>
<!-- Avoid using showoutput="true" and formatters...? -->
<!-- <formatter type="plain" /> to screen -->
<formatter type="xml" /> <!-- to file -->
<batchtest fork="true" todir="${reports}/all/">
<fileset dir="${src}">
<include name="**/uml/AllUmlTests.java" />
</fileset>
</batchtest>
<jvmarg value="-Dmomut.temp.dir=${momut.temp.dir}"/>
</junit>
</target>

<!-- Target to execute all smoke tests -->
<target name="testAllSmoke" depends="buildTests" description="Run all tests as suite">
<mkdir dir="${reports}/all-smoke/" />
<junit haltonfailure="no" printsummary="yes" showoutput="true">
<classpath refid="classpath"/>
<!-- Avoid using showoutput="true" and formatters...? -->
<!-- <formatter type="plain" /> to screen -->
<formatter type="xml" /> <!-- to file -->
<batchtest fork="true" todir="${reports}/all-smoke/">
<fileset dir="${src}">
<include name="**/uml/SmokeUmlTests.java" />
</fileset>
</batchtest>
<jvmarg value="-Dmomut.temp.dir=${momut.temp.dir}"/>
</junit>
</target>

<!-- Macro to copy the resources from the ${src} directory into the ${bin} directory -->
<macrodef name="copyResources">
<sequential>
<copy todir="${bin}">
<fileset dir="${src}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</sequential>
</macrodef>

<!-- Target to clean all the resources created by a build process -->
<target name="clean">
<echo>Cleanup directories...</echo>
<delete dir="${bin}" />
<delete dir="${ant.libs}" />
<delete dir="${reports.dir}" />
<delete dir="${momut.temp.dir}" />
<delete dir="${temp.dir}" />
<delete file="${libs}/${momutJar}" />
</target>

<target name="emptyTest" depends="buildTests" description="Run an empty test (Useful for testing dependencies)">
<echo>Empty Test</echo>
</target>

</project>