|
1 <!--**************************************************************************** |
|
2 * Configuration tool test cases |
|
3 * This ant build.xml will compile the system test cases and execute them. |
|
4 ****************************************************************************--> |
|
5 <project name="ConfigurationTool system tests" default="all"> |
|
6 <property file="../common.properties"/> |
|
7 <property file="../install.properties"/> |
|
8 <property file="build.properties"/> |
|
9 <property file="../test.properties"/> |
|
10 |
|
11 <!-- set global properties for this build --> |
|
12 |
|
13 <target name="all" depends="clean, init, resource, compile, test"/> |
|
14 |
|
15 <target name="clean"> |
|
16 <delete dir="${tests.target}" quiet="true" /> |
|
17 </target> |
|
18 |
|
19 <target name="clean-resource"> |
|
20 <delete dir="${install.dir}/testdata" quiet="true" /> |
|
21 </target> |
|
22 |
|
23 <!-- create the necessary folders --> |
|
24 <target name="init"> |
|
25 <mkdir dir="${tests.target}/test-results"/> |
|
26 <mkdir dir="${tests.target}/test-classes"/> |
|
27 </target> |
|
28 |
|
29 <!-- copy the needed system testing data to the install folder --> |
|
30 <target name="resource"> |
|
31 <!-- Copy all from testdata to testdata --> |
|
32 <copy todir="${install.dir}/testdata"> |
|
33 <fileset dir="${tests.data}" includes="**/*"/> |
|
34 </copy> |
|
35 </target> |
|
36 |
|
37 <target name="compile" depends="init" |
|
38 description="compile the test source"> |
|
39 <!-- Compile the java code from ${src} into ${build} --> |
|
40 <javac srcdir="${tests.src}" destdir="${tests.target}/test-classes"> |
|
41 <classpath> |
|
42 <pathelement location="lib/junit.jar"/> |
|
43 </classpath> |
|
44 </javac> |
|
45 </target> |
|
46 |
|
47 <!-- nothing to do on jar target --> |
|
48 <target name="jar"/> |
|
49 |
|
50 <!-- Build target will commit all the build steps and can be used for incremental |
|
51 building, because ant recognized changed files --> |
|
52 <target name="build" depends="init, resource, compile, jar"/> |
|
53 |
|
54 <target name="test" depends="regtest,newtest,acctest"/> |
|
55 |
|
56 <target name="acctest" depends="init,resource,compile"> |
|
57 <junit haltonfailure="no" printsummary="on" timeout="500000" fork="on" dir="${install.dir}"> |
|
58 <classpath> |
|
59 <pathelement location="${tests.target}/test-classes"/> |
|
60 <pathelement location="lib/junit.jar"/> |
|
61 </classpath> |
|
62 <formatter type="brief" usefile="true"/> |
|
63 <formatter type="xml" /> |
|
64 <batchtest todir="${tests.target}/test-results" > |
|
65 <fileset dir="${tests.target}/test-classes"> |
|
66 <include name="acctest/Tc*.class"/> |
|
67 </fileset> |
|
68 </batchtest> |
|
69 </junit> |
|
70 </target> |
|
71 <target name="newtest" depends="init,resource,compile"> |
|
72 <junit haltonfailure="no" printsummary="on" fork="on" timeout="500000" dir="${install.dir}"> |
|
73 <classpath> |
|
74 <pathelement location="${tests.target}/test-classes"/> |
|
75 <pathelement location="lib/junit.jar"/> |
|
76 </classpath> |
|
77 <formatter type="brief" usefile="true"/> |
|
78 <formatter type="xml" /> |
|
79 <batchtest todir="${tests.target}/test-results" > |
|
80 <fileset dir="${tests.target}/test-classes"> |
|
81 <include name="newtest/Tc*.class"/> |
|
82 </fileset> |
|
83 </batchtest> |
|
84 </junit> |
|
85 </target> |
|
86 <target name="regtest" depends="init,resource,compile"> |
|
87 <junit haltonfailure="no" printsummary="on" fork="on" timeout="500000" dir="${install.dir}"> |
|
88 <classpath> |
|
89 <pathelement location="${tests.target}/test-classes"/> |
|
90 <pathelement location="lib/junit.jar"/> |
|
91 </classpath> |
|
92 <formatter type="brief" usefile="true"/> |
|
93 <formatter type="xml" /> |
|
94 <batchtest todir="${tests.target}/test-results" > |
|
95 <fileset dir="${tests.target}/test-classes"> |
|
96 <include name="regtest/Tc*.class"/> |
|
97 </fileset> |
|
98 </batchtest> |
|
99 </junit> |
|
100 </target> |
|
101 |
|
102 <!-- ==== COVERAGE ==== --> |
|
103 |
|
104 <path id="tests.class.path"> |
|
105 <path refid="project.class.path"/> |
|
106 <fileset dir="../tests/lib" casesensitive="no"> |
|
107 <include name="*.jar"/> |
|
108 </fileset> |
|
109 </path> |
|
110 |
|
111 <path id="inst.class.path"> |
|
112 <fileset dir="${common.plugin-lib}" casesensitive="no"> |
|
113 <include name="**/*.jar"/> |
|
114 </fileset> |
|
115 <fileset dir="${common.plugin-dist}" casesensitive="no"> |
|
116 <include name="**/*.jar"/> |
|
117 <include name="*.jar"/> |
|
118 </fileset> |
|
119 </path> |
|
120 |
|
121 <path id="test.inst.class.path"> |
|
122 <fileset dir="${common.plugin-lib}" casesensitive="no"> |
|
123 <include name="**/*.jar"/> |
|
124 </fileset> |
|
125 <fileset dir="${common.plugin-dist}" casesensitive="no"> |
|
126 <include name="**/*.jar"/> |
|
127 <include name="*.jar"/> |
|
128 </fileset> |
|
129 <fileset dir="../tests/lib" casesensitive="no"> |
|
130 <include name="*.jar"/> |
|
131 </fileset> |
|
132 |
|
133 </path> |
|
134 |
|
135 <!-- Set emma.lib to refer to the list of EMMA jar files --> |
|
136 <path id="emma.lib" > |
|
137 <fileset dir="lib"> |
|
138 <include name="*.jar"/> |
|
139 </fileset> |
|
140 </path> |
|
141 |
|
142 <!-- Define which classes will be reported in the coverage reports --> |
|
143 <!-- (by default, we will include all classes and assume --> |
|
144 <!-- that your project's output folder is target/classes --> |
|
145 <path id="emma.coverage.classes" > |
|
146 <pathelement location="build/bin" /> |
|
147 </path> |
|
148 |
|
149 <!-- Load <emma> and <emmajava> custom tasks so that they can be used in ANT --> |
|
150 <taskdef resource="emma_ant.properties" classpathref="emma.lib"/> |
|
151 |
|
152 <target name="_inst_compile" > |
|
153 <echo message="plugin-build-template.xml ${pluginName} _inst_compile" level="debug"/> |
|
154 <!--<antcall target="inst_compile"/>--> |
|
155 <!--<antcall target="jar"/>--> |
|
156 </target> |
|
157 |
|
158 <target name="_test_coverage" > |
|
159 <echo message="plugin-build-template.xml ${pluginName} _test_coverage" level="debug"/> |
|
160 <antcall target="init_test"/> |
|
161 <antcall target="test_compile"/> |
|
162 <antcall target="test_coverage_execution"/> |
|
163 <antcall target="test_coverage_report"/> |
|
164 </target> |
|
165 |
|
166 <target name="resource_inst" depends="init"> |
|
167 <echo message="plugin-build-template.xml ${pluginName} resource" level="debug"/> |
|
168 <copy todir="${common.plugin-target}/inst/"> |
|
169 <fileset refid="plugin-resources" /> |
|
170 </copy> |
|
171 <copy todir="${common.plugin-target}/bin/"> |
|
172 <fileset dir="${common.plugin-src.dir}" includes="**/*.properties"/> |
|
173 <fileset dir="${common.plugin-src.dir}" includes="**/*.tokens"/> |
|
174 <fileset dir="${common.plugin-src.dir}" includes="**/*.g"/> |
|
175 <fileset dir="${common.plugin-src.dir}" includes="**/*.txtjet"/> |
|
176 </copy> |
|
177 </target> |
|
178 |
|
179 <target name="compile_inst" depends="emma, resource, resource_inst" description="compile the source with instrumentation"> |
|
180 <echo message="plugin-build-template.xml ${pluginName} compile_inst" level="debug"/> |
|
181 <!-- Update manifest file with value from -Dversion=string --> |
|
182 <manifest file="${common.plugin-target}/bin/META-INF/MANIFEST.MF" mode="update"> |
|
183 <attribute name="Bundle-ReleaseVersion" value="${common.releaseversion}"/> |
|
184 <attribute name="Bundle-Date" value="${common.builddate}"/> |
|
185 <attribute name="Bundle-RepositoryVersion" value="${common.svnversion}"/> |
|
186 </manifest> |
|
187 |
|
188 <!-- Compile the java code from ${src} into ${build} --> |
|
189 <javac executable="${common.javac-exe}" |
|
190 debug="on" |
|
191 verbose="${common.javac-verbose}" |
|
192 fork="${common.javac-fork}" |
|
193 compiler="${common.javac-compiler}" |
|
194 srcdir="${common.plugin-src.dir}" |
|
195 destdir="${common.plugin-target}/bin" |
|
196 target="${common.javac-target}" |
|
197 source="${common.javac-source}"> |
|
198 <classpath refid="inst.class.path"/> |
|
199 </javac> |
|
200 |
|
201 <emma enabled="true"> |
|
202 <instr instrpathref="emma.coverage.classes" |
|
203 destdir="${common.instr.dir}" |
|
204 metadatafile="${common.unittest.reports.emma.dir}/${pluginName}-metadata.emma" |
|
205 merge="true"> |
|
206 <filter value="${emma.filter}" /> |
|
207 </instr> |
|
208 </emma> |
|
209 |
|
210 <copy todir="${common.plugin-target}/bin"> |
|
211 <fileset dir="${common.instr.dir}" > |
|
212 <include name="**/*.class" /> |
|
213 </fileset> |
|
214 </copy> |
|
215 |
|
216 </target> |
|
217 |
|
218 <target name="test_coverage_execution" > |
|
219 <echo message="plugin-build-template.xml ${pluginName} test_coverage_execution" level="debug"/> |
|
220 |
|
221 <junit printsummary="yes" haltonfailure="no" fork="true"> |
|
222 <classpath> |
|
223 <pathelement location="${common.unittest.bin.dir}"/> |
|
224 <pathelement location="${common.instr.dir}"/> |
|
225 <path refid="test.inst.class.path"/> |
|
226 <path refid="emma.lib" /> |
|
227 </classpath> |
|
228 |
|
229 <formatter type="xml"/> |
|
230 |
|
231 <batchtest todir="${common.unittest.reports.dir}"> |
|
232 <fileset dir="${common.unittest.bin.dir}"> |
|
233 <include name="**/*Test*.class"/> |
|
234 <exclude name="**/AllTests.class"/> |
|
235 </fileset> |
|
236 </batchtest> |
|
237 |
|
238 <jvmarg value="-Demma.coverage.out.file=${pluginName}/${common.unittest.reports.emma.dir}/${pluginName}-coverage.emma" /> |
|
239 <jvmarg value="-Demma.coverage.out.merge=true" /> |
|
240 </junit> |
|
241 </target> |
|
242 |
|
243 <target name="emma" description="turns on EMMA's instrumentation/reporting" > |
|
244 <echo message="plugin-build-template.xml ${pluginName} emma" level="debug"/> |
|
245 <property name="emma.enabled" value="true" /> |
|
246 |
|
247 <mkdir dir="${common.instr.dir}" /> |
|
248 |
|
249 <property name="emma.filter" value="" /> |
|
250 </target> |
|
251 |
|
252 <target name="test_coverage_report"> |
|
253 <echo message="plugin-build-template.xml ${pluginName} test_coverage_report" level="debug"/> |
|
254 |
|
255 <junitreport todir="${common.unittest.reports.dir}"> |
|
256 <fileset dir="${common.unittest.reports.dir}"> |
|
257 <include name="TEST-*.xml"/> |
|
258 </fileset> |
|
259 <report format="frames" todir="${common.unittest.reports.dir}/html"/> |
|
260 </junitreport> |
|
261 <copy todir="../tests/emma/src"> |
|
262 <fileset dir="src"> |
|
263 <include name="**/*.java"/> |
|
264 </fileset> |
|
265 </copy> |
|
266 |
|
267 <copy todir="../tests/target/test-results/"> |
|
268 <fileset dir="${common.unittest.reports.dir}"> |
|
269 <include name="TEST-*.xml"/> |
|
270 </fileset> |
|
271 </copy> |
|
272 |
|
273 <copy todir="../tests/target/emma"> |
|
274 <fileset dir="${common.unittest.reports.emma.dir}"> |
|
275 <include name="*.emma"/> |
|
276 </fileset> |
|
277 </copy> |
|
278 |
|
279 |
|
280 <!-- if enabled, generate coverage report(s): --> |
|
281 <!--<emma enabled="true"> |
|
282 <report sourcepath="${common.plugin-src.dir}" sort="+block,+name,+method,+class" metrics="method:70,block:80,line:80,class:100"> |
|
283 <fileset dir="${common.unittest.reports.emma.dir}" > |
|
284 <include name="*.emma" /> |
|
285 </fileset> |
|
286 <xml outfile="${common.unittest.reports.emma.dir}/coverage.xml" depth="package"/> |
|
287 <html outfile="${common.unittest.reports.emma.dir}/coverage.html" depth="method" columns="name,class,method,block,line"/> |
|
288 </report> |
|
289 </emma>--> |
|
290 |
|
291 </target> |
|
292 |
|
293 |
|
294 </project> |