forked from MOEAFramework/MOEAFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.xml
184 lines (153 loc) · 7.24 KB
/
test.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?xml version="1.0"?>
<!--
Copyright 2009-2015 David Hadka
This file is part of the MOEA Framework.
The MOEA Framework is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
The MOEA Framework is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the MOEA Framework. If not, see <http://www.gnu.org/licenses/>.
Use of these build scripts requires Apache Ant to be installed. See
<http://ant.apache.org/> for instructions on installing Apache Ant.
-->
<project name="MOEA Framework Testing" basedir="." default="test">
<!-- Loads properties from properties file and environment -->
<property file="META-INF/build.properties" />
<property environment="env" />
<!-- The working folder for these Ant build targets -->
<property name="build" value="build" />
<!-- The folder where compiled files ready for distribution are saved -->
<property name="dist" value="dist" />
<!-- The folder where JUnit test results are saved -->
<property name="results" value="test-results" />
<!-- Classpath of third-party libraries used by the MOEA Framework -->
<path id="classpath">
<fileset dir="lib" includes="*.jar" />
</path>
<!-- List of files required in every distribution -->
<path id="requiredfiles">
<fileset file="README" />
<fileset file="LICENSE" />
<fileset file="NEWS" />
<fileset file="HELP" />
</path>
<!-- Determines which dependencies are available -->
<target name="check-dependencies">
<available classname="org.junit.Assert" classpathref="classpath"
property="junit-exists" />
<!-- Commented to always force recompiling of the JAR -->
<!--<available file="${dist}/${shortname}-${version}.jar"
property="binary-exists" />-->
</target>
<!-- Conditionally builds the MOEA Framework JAR -->
<target name="check-binary" depends="check-dependencies"
unless="binary-exists">
<ant target="build-binary" />
</target>
<!-- Displays message and fails build if JUnit is not available -->
<target name="check-junit" depends="check-dependencies"
unless="junit-exists">
<echo>==================================================================</echo>
<echo> The JUnit library is missing from your classpath. Please</echo>
<echo> download the latest JUnit 4 library from http://www.junit.org/,</echo>
<echo> and place the JAR in the lib/ folder.</echo>
<echo>==================================================================</echo>
<fail message="JUnit library missing"/>
</target>
<!-- Builds the C executables in auxiliary/c/ used for testing -->
<target name="build-c">
<exec executable="make" dir="auxiliary/c/" failifexecutionfails="false">
<arg value="clean" />
</exec>
<exec executable="make" dir="auxiliary/c/"
failifexecutionfails="false" />
</target>
<!-- Builds the MOEA Framework Test JAR -->
<target name="build-tests"
depends="check-dependencies,check-binary,check-junit">
<delete dir="${build}" />
<mkdir dir="${build}" />
<javac destdir="${build}" debug="${java.debug}"
includeantruntime="false"
encoding="UTF-8">
<src path="test" />
<src path="examples" />
<classpath>
<path refid="classpath" />
<pathelement location="${dist}/${shortname}-${version}.jar" />
</classpath>
</javac>
<copy todir="${build}">
<fileset excludes="**/*.java" dir="test" />
</copy>
<copy todir="${build}/META-INF">
<path refid="requiredfiles" />
</copy>
<jar basedir="${build}"
jarfile="${dist}/${shortname}-${version}-Test.jar" />
</target>
<!-- Runs all JUnit tests -->
<target name="run-tests" depends="build-tests, build-c">
<delete dir="${results}" />
<mkdir dir="${results}" />
<mkdir dir="${results}/raw" />
<junit printsummary="on" haltonfailure="false"
tempdir="${results}/raw" errorproperty="junit.failure"
failureproperty="junit.failure">
<classpath>
<path refid="classpath" />
<fileset file="${dist}/${shortname}-${version}.jar" />
<fileset file="${dist}/${shortname}-${version}-Test.jar" />
</classpath>
<batchtest todir="${results}/raw">
<formatter type="xml" />
<zipfileset src="${dist}/${shortname}-${version}-Test.jar">
<include name="**/*Test.class" />
<exclude name="org/moeaframework/algorithm/AlgorithmTest.class" />
<exclude name="org/moeaframework/core/indicator/IndicatorTest.class" />
<exclude name="org/moeaframework/analysis/collector/CollectorTest.class" />
<exclude name="org/moeaframework/core/operator/DistributionVariationTest.class" />
<exclude name="org/moeaframework/core/operator/MeanCentricVariationTest.class" />
<exclude name="org/moeaframework/core/operator/ParentCentricVariationTest.class" />
<exclude name="org/moeaframework/core/operator/ParentImmutabilityTest.class" />
<exclude name="org/moeaframework/core/operator/PointCrossoverTest.class" />
<exclude name="org/moeaframework/core/operator/TypeSafetyTest.class" />
<exclude name="org/moeaframework/problem/ProblemTest.class" />
<exclude name="org/moeaframework/util/sequence/SequenceTest.class" />
<exclude name="org/moeaframework/util/statistics/IntervalRatioStatisticalTest.class" />
<exclude name="org/moeaframework/util/statistics/KruskalWallisTest.class" />
<exclude name="org/moeaframework/util/statistics/MannWhitneyUTest.class" />
<exclude name="org/moeaframework/util/statistics/OrdinalStatisticalTest.class" />
<exclude name="org/moeaframework/util/statistics/SingleSampleTTest.class" />
<exclude name="org/moeaframework/util/statistics/StatisticalTest.class" />
<exclude name="org/moeaframework/util/statistics/TwoSampleTTest.class" />
<exclude name="org/moeaframework/util/statistics/WilcoxonSignedRanksTest.class" />
</zipfileset>
</batchtest>
</junit>
<junitreport todir="${results}">
<fileset dir="${results}/raw">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${results}"/>
</junitreport>
</target>
<!-- The main test target, running all JUnit tests and displaying the results -->
<target name="test" depends="run-tests" if="junit.failure"
description="Run the unit tests">
<echo>==================================================================</echo>
<echo> One or more unit tests failed! Open test-results/index.html to</echo>
<echo> see which tests failed.</echo>
<echo> </echo>
<echo> Note: due to the stochastic nature of the MOEA Framework, there</echo>
<echo> is a small chance that some correct tests will fail. Please</echo>
<echo> repeat the tests prior to notifying the developers.</echo>
<echo>==================================================================</echo>
<fail message="Unit test(s) failed. See reports!"/>
</target>
</project>