All Downloads are FREE. Search and download functionalities are using the official Maven repository.

MOEAFramework-2.10.test.xml Maven / Gradle / Ivy

There is a newer version: 4.4
Show newest version
<?xml version="1.0"?>
<!--
Copyright 2009-2016 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">
		<delete dir="${results}" />
		<mkdir dir="${results}" />
		<mkdir dir="${results}/raw" />

		<junit haltonfailure="false" tempdir="${results}/raw"
				errorproperty="junit.failure"
				failureproperty="junit.failure" fork="true">
			<classpath>
				<path refid="classpath" />
				<fileset file="${dist}/${shortname}-${version}.jar" />
				<fileset file="${dist}/${shortname}-${version}-Test.jar" />
			</classpath>
			<sysproperty key="ON_TRAVIS" value="${ON_TRAVIS}"/>
			<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/LocalizationTest.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" />
					<exclude name="org/moeaframework/util/weights/WeightGeneratorTest.class" />
				</zipfileset>
			</batchtest>
			<formatter type="plain" usefile="false" />
			<formatter type="plain" />
		</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>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy