-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-test.xml
165 lines (122 loc) · 5.72 KB
/
build-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
<project name="CoilAppTestSuite" default="usage" basedir=".">
<import file="${basedir}/build-base.xml" />
<description>ANT build script for the Spring App Test Suite</description>
<property name="src.tests.dir" location="${basedir}/test"/>
<property name="build.tests.dir" location="${build.tmp.dir}/test" />
<property name="output.reports.junit" location="${basedir}/reports/junit"/>
<property name="output.reports.tmp.junit" location="${basedir}/reports/tmp/junit"/>
<!-- FindBugs Configuration -->
<property name="findbugs.home.dir" location="${basedir}/compile/findbugs" />
<property name="output.reports.findbugs" location="${basedir}/reports/findbugs"/>
<!-- Default config values for JUNIT execution that may be overridden -->
<property name="junit.fork" value="yes"/>
<property name="junit.includefiles" value="**/*Test.java"/>
<property name="junit.excludefiles" value=""/>
<!-- Cobertura Code Coverage Configuration -->
<!-- Cobertura unit test coverage -->
<property name="cobertura.dir" location="${basedir}/compile/cobertura" />
<property name="output.reports.cobertura" location="${basedir}/reports/cobertura"/>
<property name="cobertura.ser.file" value="${basedir}/reports/tmp/cobertura.ser" />
<property name="cobertura.instrument.dir" location="${basedir}/reports/tmp/coberturainstrument" />
<path id="cobertura.path">
<fileset dir="${cobertura.dir}">
<include name="cobertura.jar" />
<include name="lib/**/*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.path" resource="tasks.properties" />
<target name="cobertura-instrument" depends="compile-test" description="Create Corbetura instrumentation">
<mkdir dir="${cobertura.instrument.dir}" />
<cobertura-instrument
datafile="${cobertura.ser.file}"
todir="${cobertura.instrument.dir}">
<fileset dir="${build.src.dir}">
<include name="**/*.class" />
<exclude name="**/*Test.class" />
</fileset>
</cobertura-instrument>
</target>
<target name="cobertura-report" depends="junit" description="Create Corbetura coverage report">
<mkdir dir="${output.reports.cobertura}" />
<cobertura-report
format="xml"
datafile="${cobertura.ser.file}"
destdir="${output.reports.cobertura}"
srcdir="${src.dir}" />
</target>
<target name="junit" depends="clean-test,compile-test,cobertura-instrument">
<junit printsummary="yes" haltonfailure="no">
<sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.ser.file}" />
<classpath location="${cobertura.instrument.dir}" />
<classpath location="${build.tests.dir}" />
<classpath refid="classpathSrcId" />
<!--
The instrumented classes reference classes used by the
Cobertura runtime, so Cobertura and its dependencies
must be on your classpath.
-->
<classpath refid="cobertura.path" />
<!-- <formatter type="plain" /> -->
<formatter type="xml" />
<batchtest fork="${junit.fork}" todir="${output.reports.junit}">
<fileset dir="${src.tests.dir}">
<include name="${junit.includefiles}"/>
<exclude name="${junit.excludefiles}"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="junit-report" depends="junit" description="Creates a JUNIT report from the output of the JUNIT tests assumed to have previously run. Not necessarily dependent on the 'junit' task because this may be run to refresh the reports at any given time">
<junitreport todir="${output.reports.junit}">
<fileset dir="${output.reports.junit}">
<include name="*.xml" />
<exclude name="*.txt" />
</fileset>
<report format="frames" todir="${output.reports.junit}" />
</junitreport>
</target>
<target name="compile-test" description="Compiles the Test code for execution" depends="compile">
<echo>Compiling ${src.tests.dir} to ${build.tests.dir}...</echo>
<mkdir dir="${build.tests.dir}" />
<javac destdir="${build.tests.dir}" debug="true">
<src path="${src.tests.dir}" />
<classpath refid="classpathSrcId" />
</javac>
<echo>... done compiling test code to ${build.tests.dir}</echo>
</target>
<target name="clean-test" description="Cleans the file system in preparation for a new test run">
<delete dir="${basedir}/reports" />
<mkdir dir="${basedir}/reports" />
<mkdir dir="${output.reports.junit}" />
<delete dir="${build.tests.dir}"/>
<delete file="${cobertura.ser.file}" />
<delete dir="${cobertura.instrument.dir}" />
</target>
<!-- -->
<target name="findbugs"
depends="compile-test"
description="Run code analysis over code to check for problems." >
<mkdir dir="${output.reports.findbugs}" />
<!-- Fail this target if FindBugs is not installed. -->
<available file="${findbugs.home.dir}/lib/findbugs.jar" property="findbugs.available" />
<fail unless="findbugs.available"
message="Error: FINDBUGS_HOME not set or findbugs.jar not found." />
<taskdef name="findbugs"
classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${findbugs.home.dir}/lib/findbugs-ant.jar" />
<!-- Run FindBugs. -->
<findbugs home="${findbugs.home.dir}"
workHard="true"
output="xml"
reportLevel="low"
outputFile="${output.reports.findbugs}/findbugs.xml" >
<!-- stylesheet="plain.xsl" -->
<!-- output="xml:withMessages" -->
<sourcePath path="${build.src.dir}" />
<class location="${build.src.dir}" />
<auxClasspath refId="classpathSrcId" />
</findbugs>
</target>
<!-- <target name="run-tests" depends="junit, junit-report, cobertura-report, findbugs" /> -->
<target name="run-tests" depends="junit, cobertura-report, findbugs" />
</project>