Project

General

Profile

root / trunk / compiler / ooasCompiler_tests / build.xml

1 2 krennw
<?xml version="1.0" encoding="UTF-8"?>
2
3
<project name="MoMuT Test" default="buildTests" basedir=".">
4
        <!-- The directory containing the executable MoMuT jar file -->
5
        <property name="momutDir"       value="../momut/MoMuT"  />
6
        <!-- The name of the destination .jar file copied from the MoMuT project. -->
7
        <property name="momutJar"       value="MoMuT.jar"    />
8
        <property name="libs"           value="lib"          />
9
        <property name="src"            value="src"          />
10
        <property name="bin"            value="bin"          />
11
        <property name="build.number"   value="default"      />
12
        <property name="reports.dir"    value="reports"      />
13
        <property name="reports"        value="${reports.dir}/build-${build.number}"      />
14
        <property name="temp.dir"       value="temp"                                    />
15
        <property name="momut.temp.dir" value="${temp.dir}/build-${build.number}"       />
16
17
        <path id="classpath">
18
                <fileset dir="${libs}">
19
                        <include name="**/*.jar" />
20
                </fileset>
21
                <fileset dir="${bin}">
22
                        <include name="**/*.jar" />
23
                </fileset>
24
                <pathelement location="${bin}" />
25
        </path>
26
27
        <!-- Target to initialize common resources (e.g. create directories, timestamps, etc.) -->
28
        <target name="init" description="Initialize build process">
29
                <echo>Initilize build process...</echo>
30
                <echo>MoMuT temp directory set to ${momut.temp.dir}</echo>
31
                <mkdir dir="${bin}"             />
32
                <mkdir dir="${reports}"                 />
33
                <mkdir dir="${temp.dir}"                />
34
35
                <!-- Copy the .jar file of the MoMuT project into current workspaces ${lib} directory. -->
36
                <copy tofile="${libs}/${momutJar}" overwrite="yes">
37
                        <fileset dir="${momutDir}" includes="*.jar"/>
38
                </copy>
39
        </target>
40
41
        <!-- Target to build all the junit test environment -->
42
        <target name="buildTests" depends="init" description="Build the java test classes">
43
                <javac srcdir="${src}" destdir="${bin}" debug="false" deprecation="true" optimize="true" includeantruntime="false">
44
                        <classpath refid="classpath"/>
45
                </javac>
46
                <copyResources/>
47
        </target>
48
49
        <!-- Target to execute all UML2OOAS test -->
50
        <target name="testUml2OoasSuite" depends="buildTests" description="Run all UML2OOAS tests as suite">
51
                <echo>Running Uml2Ooas tests (working directory: ${basedir})</echo>
52
                <mkdir dir="${reports}/uml2ooas/" />
53
                <junit haltonfailure="no" printsummary="yes" showoutput="true">
54
                        <classpath refid="classpath"/>
55
                        <!-- Avoid using showoutput="true" and formatters..?. -->
56
                        <!-- <formatter type="plain"  />  to screen -->
57
                        <formatter type="xml" /> <!-- to file -->
58
                        <batchtest fork="true" todir="${reports}/uml2ooas/">
59
                                <fileset dir="${src}">
60
                                        <include name="**/uml2ooas/AllUml2OoasTests.java" />
61
                                </fileset>
62
                        </batchtest>
63
                        <jvmarg value="-Dmomut.temp.dir=${momut.temp.dir}"/>
64
                </junit>
65
        </target>
66
67
        <!-- Target to execute all tests -->
68
        <target name="testAllSuite" depends="buildTests" description="Run all tests as suite">
69
                <mkdir dir="${reports}/all/" />
70
                <junit haltonfailure="no" printsummary="yes" showoutput="true">
71
                        <classpath refid="classpath"/>
72
                        <!-- Avoid using showoutput="true" and formatters...? -->
73
                        <!--  <formatter type="plain" /> to screen -->
74
                        <formatter type="xml" />   <!-- to file -->
75
                        <batchtest fork="true" todir="${reports}/all/">
76
                                <fileset dir="${src}">
77
                                        <include name="**/uml/AllUmlTests.java" />
78
                                </fileset>
79
                        </batchtest>
80
                        <jvmarg value="-Dmomut.temp.dir=${momut.temp.dir}"/>
81
                </junit>
82
        </target>
83
84
        <!-- Target to execute all smoke tests -->
85
        <target name="testAllSmoke" depends="buildTests" description="Run all tests as suite">
86
                <mkdir dir="${reports}/all-smoke/" />
87
                <junit haltonfailure="no" printsummary="yes" showoutput="true">
88
                        <classpath refid="classpath"/>
89
                        <!-- Avoid using showoutput="true" and formatters...? -->
90
                        <!--  <formatter type="plain" /> to screen -->
91
                        <formatter type="xml" />   <!-- to file -->
92
                        <batchtest fork="true" todir="${reports}/all-smoke/">
93
                                <fileset dir="${src}">
94
                                        <include name="**/uml/SmokeUmlTests.java" />
95
                                </fileset>
96
                        </batchtest>
97
                        <jvmarg value="-Dmomut.temp.dir=${momut.temp.dir}"/>
98
                </junit>
99
        </target>
100
101
        <!-- Macro to copy the resources from the ${src} directory into the ${bin} directory -->
102
        <macrodef name="copyResources">
103
                <sequential>
104
                        <copy todir="${bin}">
105
                                <fileset dir="${src}">
106
                                        <exclude name="**/*.java"/>
107
                                </fileset>
108
                        </copy>
109
                </sequential>
110
        </macrodef>
111
112
        <!-- Target to clean all the resources created by a build process -->
113
        <target name="clean">
114
                <echo>Cleanup directories...</echo>
115
                <delete dir="${bin}"               />
116
                <delete dir="${ant.libs}"          />
117
                <delete dir="${reports.dir}"       />
118
                <delete dir="${momut.temp.dir}"    />
119
                <delete dir="${temp.dir}"          />
120
                <delete file="${libs}/${momutJar}" />
121
        </target>
122
123
        <target name="emptyTest" depends="buildTests" description="Run an empty test (Useful for testing dependencies)">
124
                <echo>Empty Test</echo>
125
        </target>
126
127
</project>