This repository has been archived by the owner on Dec 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
169 lines (147 loc) · 5.29 KB
/
build.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
<?xml version="1.0"?>
<project default="all" basedir=".">
<!--
Reads the properties from a file.
-->
<property file="build.properties" />
<!--
Builds the XLT class path for further reference.
-->
<path id="xlt.class.path">
<pathelement path="${xlt.classes.dir}" />
<fileset dir="${xlt.lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<!--
Builds the test suite class path for further reference.
-->
<path id="test.suite.class.path">
<path refid="xlt.class.path" />
<pathelement location="${test.classes.dir}" />
<fileset dir="${test.lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<!--
Deletes any result file from a previous test run.
-->
<target name="clean">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${test.classes.dir}" includes="**/*" />
<fileset dir="${test.results.dir}" includes="**/*" />
</delete>
</target>
<!--
Compiles the Java sources in ${test.src.dir} to ${test.classes.dir}.
Any non-Java file in the sources dir will be copied there, too.
-->
<target name="compile">
<mkdir dir="${test.classes.dir}" />
<javac srcdir="${test.src.dir}" destdir="${test.classes.dir}" debug="on" optimize="off" deprecation="on">
<classpath refid="test.suite.class.path" />
</javac>
<copy todir="${test.classes.dir}">
<fileset dir="${test.src.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<!--
Prepares everything for testing.
-->
<target name="test.init" depends="compile">
<mkdir dir="${test.results.dir}" />
</target>
<!--
Performs a functional test by running the configured Java test cases.
-->
<target name="test.java" depends="test.init">
<!--
Run the junit tests.
-->
<junit forkmode="once" printsummary="on" dir="${basedir}">
<!-- build the class path -->
<classpath refid="test.suite.class.path" />
<!-- configure the environment for XLT-based test cases -->
<sysproperty key="com.xceptance.xlt.home" value="${basedir}" />
<sysproperty key="com.xceptance.xlt.data.directory" value="${test.config.dir}/data" />
<sysproperty key="log4j.configuration" value="file:${test.config.dir}/dev-log4j.properties" />
<!-- configure the test result formatter -->
<formatter type="xml" />
<!-- execute all configured tests -->
<batchtest fork="yes" todir="${test.results.dir}">
<fileset dir="${test.src.dir}" includes="${test.cases.java}" />
</batchtest>
</junit>
</target>
<!--
Performs a functional test by running the configured script test cases.
-->
<target name="test.script" depends="test.init">
<!--
Determine the test scripts to run from the configuration.
-->
<fileset id="scripts" dir="${test.scripts.dir}" includes="${test.cases.script}" excludes="**/*_data.xml **/*_datasets.xml" />
<pathconvert pathsep=" " dirsep="/" property="scripts" refid="scripts">
<globmapper from="${test.scripts.dir}/*.xml" to="*" handledirsep="true" />
</pathconvert>
<!--
Run the generic script test case suite.
-->
<junit forkmode="once" printsummary="on">
<!-- build the class path -->
<classpath refid="test.suite.class.path" />
<!-- configure the environment for XLT-based test cases -->
<sysproperty key="com.xceptance.xlt.home" value="${basedir}" />
<sysproperty key="com.xceptance.xlt.data.directory" value="${test.config.dir}/data" />
<sysproperty key="log4j.configuration" value="file:${test.config.dir}/dev-log4j.properties" />
<!-- configure the test result formatter -->
<formatter type="xml" />
<!-- configure the tests to run -->
<sysproperty key="com.xceptance.xlt.api.engine.scripting.ScriptTestCaseSuite.testCases" value="${scripts}" />
<!-- execute all configured tests -->
<batchtest fork="yes" todir="${test.results.dir}">
<javaresource name="com/xceptance/xlt/api/engine/scripting/ScriptTestCaseSuite.class" classpathref="xlt.class.path" />
</batchtest>
</junit>
</target>
<!--
Performs all the functional tests and creates a JUnit test report.
-->
<target name="test" depends="test.java, test.script">
<!--
Create a test report from the test results.
-->
<junitreport todir="${test.results.dir}">
<!-- determine the test result files -->
<fileset dir="${test.results.dir}">
<include name="TEST-*.xml" />
</fileset>
<!-- generate the HTML report -->
<report format="noframes" todir="${test.results.dir}" />
</junitreport>
</target>
<!--
Performs a load test with the test cases configured in the test suite.
For this, the XLT load test environment is used.
-->
<target name="loadtest" depends="compile">
<!--
Determine the command to run depending on the OS.
-->
<condition property="command" value="mastercontroller.cmd" else="mastercontroller.sh">
<os family="windows" />
</condition>
<!--
Run the master controller using an embedded agent controller.
-->
<exec executable="${xlt.bin.dir}/${command}" failonerror="true">
<arg line="-auto -embedded -report" />
</exec>
</target>
<!--
Executes all targets one after the other.
-->
<target name="all" depends="clean, test, loadtest" />
</project>