-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
executable file
·137 lines (115 loc) · 4.67 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
<!--
Copyright (C) 2010 Alexandre Berman, Lazybear Consulting ([email protected])
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
usage: ant help
-->
<project name="QA" basedir=".">
<!-- REPORTS -->
<!-- you can pass '-Dqa.reports=/some/path' to ant and it will be used for qa.reports -->
<condition property="runtime.report" value="" else="${qa.reports}">
<not>
<isset property="qa.reports"/>
</not>
</condition>
<!-- check if qa.report is set to any value or is empty -->
<condition property="session.reports" value="" else="REPORTS_DIR=${runtime.report}">
<equals arg1="${runtime.report}" arg2=""/>
</condition>
<!-- KEYWORDS -->
<!-- check if qa.keywords is set to anything sensible (usually via command line option -Dqa.keywords='...' -->
<condition property="runtime.keyword" value="" else="${qa.keywords}">
<not>
<isset property="qa.keywords"/>
</not>
</condition>
<!-- check if runtime.keyword is set to any value or is empty -->
<condition property="session.keywords" value="" else="KEYWORDS='${runtime.keyword}'">
<equals arg1="${runtime.keyword}" arg2=""/>
</condition>
<!-- RAKE -->
<condition property="rake.path" value="rake">
<os family="unix" />
</condition>
<condition property="rake.path" value="${ruby.home}\bin\rake.bat">
<os family="windows" />
</condition>
<!-- test.base.url -->
<condition property="qa.base.url" value="" else="${test.base.url}">
<not>
<isset property="test.base.url"/>
</not>
</condition>
<echo message="qa.reports : ${runtime.report}"/>
<echo message="session.keywords : ${runtime.keyword}"/>
<echo message="qa.base.url : ${qa.base.url}"/>
<macrodef name="check-connection">
<sequential>
<exec executable="ruby" failonerror="true">
<arg line="${basedir}/lib/check_connection.rb ${qa.base.url}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="run-rc">
<attribute name="option"/>
<sequential>
<exec executable="ruby" spawn="true">
<arg line="${basedir}/lib/rc.rb @{option}"/>
<env key="JAVA_HOME" value="${java.home}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="run-qa">
<sequential>
<run-rc option="start"/>
<echo message="-- executing: ${rake.path} ${session.keywords} ${session.reports}"/>
<exec executable="${rake.path}" resultproperty="test.run">
<env key="qa.base.url" value="${qa.base.url}"/>
<arg line="${session.keywords} ${session.reports}"/>
</exec>
<echo message="-- qa.base.url set to: ${qa.base.url}"/>
<echo message="-- reports set to : ${runtime.report}"/>
<echo message="-- keyword set to : ${runtime.keyword}"/>
<echo message="-- executing QA tests ..."/>
<run-rc option="stop"/>
</sequential>
</macrodef>
<macrodef name="finally">
<sequential>
<echo message="-- test.run result: ${test.run}"/>
<fail message="some tests failed !">
<condition>
<not>
<equals arg1="${test.run}" arg2="0"/>
</not>
</condition>
</fail>
</sequential>
</macrodef>
<target name="start-rc">
<run-rc option="start"/>
</target>
<target name="stop-rc">
<run-rc option="stop"/>
</target>
<target name="ci">
<check-connection />
<run-qa/>
<finally/>
</target>
<target name="help">
<echo message="-- available targets: ci, start-rc, stop-rc, help (this message)..."/>
<echo message=" you can pass '-Dqa.keywords=somekeyword' to ant and corresponding tests will execute"/>
<echo message=" you can pass '-Dqa.reports=/path/to/reports' to ant and reports will be prepared in that dir"/>
<echo message=" you can pass '-Dtest.base.url=http://server_under_test_url' to ant and it will be used as a server test url"/>
</target>
</project>