-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
239 lines (207 loc) · 7.99 KB
/
build.gradle
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
plugins {
id 'java'
id "io.qameta.allure" version "2.8.1"
}
group 'ekam.template'
sourceCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
maven { url "http://palantir.bintray.com/releases" }
}
dependencies {
// ekam
implementation('com.testvagrant.ekam:ekam:1.0.0')
implementation('com.testvagrant.ekam:ekam-atoms:1.0.0')
implementation('com.testvagrant.ekam:ekam-api:1.0.0')
// Needed for cucumber tasks
implementation('com.testvagrant.ekam:ekam-drivers:1.0.4')
implementation('com.testvagrant.ekam:ekam-report-publisher:0.0.3-beta')
implementation('com.testvagrant.ekam:ekam-commons:1.0.0')
implementation('com.testvagrant.ekam:ekam-config:1.0.3')
implementation('com.testvagrant.ekam:ekam-device-manager:1.0.0')
implementation('com.testvagrant.ekam:ekam-logger:1.0.0')
// appium
implementation('io.appium:java-client:7.5.1')
//AssertJ
implementation('org.assertj:assertj-core:3.20.2')
// selenium
implementation('org.seleniumhq.selenium:selenium-java:3.141.59')
// google
implementation('com.google.inject:guice:5.0.1')
// Test frameworks
testImplementation('org.testng:testng:7.4.0')
testImplementation('io.cucumber:cucumber-java:6.11.0')
testImplementation('io.cucumber:cucumber-testng:6.11.0')
// square
implementation('com.squareup.retrofit2:retrofit:2.9.0')
implementation('com.squareup.retrofit2:converter-gson:2.9.0')
implementation('com.squareup.okhttp3:logging-interceptor:4.9.1')
//lombok
implementation('org.projectlombok:lombok:1.18.20')
annotationProcessor('org.projectlombok:lombok:1.18.20')
testImplementation('org.projectlombok:lombok:1.18.20')
testAnnotationProcessor('org.projectlombok:lombok:1.18.20')
//allure
implementation('io.qameta.allure:allure-gradle:2.8.1')
implementation('io.qameta.allure:allure-java-commons:2.14.0')
implementation('io.qameta.allure:allure-testng:2.14.0')
implementation('io.qameta.allure:allure-okhttp3:2.14.0')
implementation('io.qameta.allure:allure-rest-assured:2.14.0')
implementation 'io.qameta.allure:allure-cucumber6-jvm:2.14.0'
// jdbi
implementation('org.jdbi:jdbi:2.78')
// Generic wait
implementation('org.awaitility:awaitility:4.1.0')
// Assertion Library
implementation('org.assertj:assertj-core:3.20.2')
}
tasks.withType(Test) {
systemProperties System.properties
}
task runWebTests(type: Test) {
filter {
excludeTestsMatching "*.mobile.*"
excludeTestsMatching "*.api.*"
excludeTestsMatching "*.db.*"
}
outputs.upToDateWhen { false }
useTestNG {
parallel = "methods"
threadCount Integer.parseInt(System.getProperty("sessions", "2"))
includeGroups System.getProperty("tags", "web")
testLogging.showStandardStreams = true
useDefaultListeners true
outputDirectory = file("$buildDir/" + System.getProperty('tags', 'NONE'))
}
}
task runMobileTests(type: Test) {
filter {
excludeTestsMatching "*.web.*"
excludeTestsMatching "*.api.*"
excludeTestsMatching "*.db.*"
}
outputs.upToDateWhen { false }
useTestNG {
parallel = "methods"
threadCount Integer.parseInt(System.getProperty("sessions", "1"))
includeGroups System.getProperty("tags", "mobile")
testLogging.showStandardStreams = true
useDefaultListeners true
outputDirectory = file("$buildDir/" + System.getProperty('tags', 'NONE'))
}
}
task runApiTests(type: Test) {
filter {
excludeTestsMatching "*.web.*"
excludeTestsMatching "*.mobile.*"
excludeTestsMatching "*.db.*"
}
outputs.upToDateWhen { false }
useTestNG {
parallel = "methods"
threadCount Integer.parseInt(System.getProperty("sessions", "4"))
includeGroups System.getProperty("tags", "api")
testLogging.showStandardStreams = true
useDefaultListeners true
outputDirectory = file("$buildDir/" + System.getProperty('tags', 'NONE'))
}
}
task runDbTests(type: Test) {
filter {
excludeTestsMatching "*.web.*"
excludeTestsMatching "*.mobile.*"
excludeTestsMatching "*.api.*"
}
outputs.upToDateWhen { false }
useTestNG {
parallel = "methods"
threadCount Integer.parseInt(System.getProperty("sessions", "4"))
includeGroups System.getProperty("tags", "db")
testLogging.showStandardStreams = true
useDefaultListeners true
outputDirectory = file("$buildDir/" + System.getProperty('tags', 'NONE'))
}
}
task runCucumberWebTests(type: JavaExec) {
main = "io.cucumber.core.cli.Main"
args = ["-p", "io.qameta.allure.cucumber6jvm.AllureCucumber6Jvm",
"-p", "pretty",
"-p", ("json:${project.buildDir}/cucumber/cucumber-report.json"),
"-p", "timeline:${project.buildDir}/cucumber/timeline/",
"-t", System.getProperty("tags", "@web"),
"--threads", System.getProperty("sessions", "1"),
"--glue", "com.testvagrant.ekamexamples.web.transferGo.steps"]
classpath = sourceSets.test.runtimeClasspath
systemProperties = [
config: System.getProperty("config", "transfergo"),
tags : System.getProperty("tags", "@web")
]
ignoreExitValue = true
}
task runCucumberMobileTests(type: JavaExec) {
main = "io.cucumber.core.cli.Main"
args = ["-p", "io.qameta.allure.cucumber6jvm.AllureCucumber6Jvm",
"-p", "pretty",
"-p", ("json:${project.buildDir}/cucumber/cucumber-report.json"),
"-p", "timeline:${project.buildDir}/cucumber/timeline/",
"-t", System.getProperty("tags", "@mobile"),
"--threads", System.getProperty("sessions", "1"),
"--glue", "com.testvagrant.ekamexamples.mobile.steps"]
classpath = sourceSets.test.runtimeClasspath
systemProperties = [
config: System.getProperty("config", "default"),
tags : System.getProperty("tags", "")
]
ignoreExitValue = true
}
def getArgs() {
List<String> args = ["-p", "io.qameta.allure.cucumber6jvm.AllureCucumber6Jvm",
"-p", "pretty",
"-p", ("json:${project.buildDir}/cucumber/cucumber-report.json"),
"-p", "timeline:${project.buildDir}/cucumber/timeline/",
"-t", System.getProperty("tags", ""),
"--threads", System.getProperty("sessions", "1")]
return args
}
allure {
version = '2.13.2'
autoconfigure = true
aspectjweaver = true
allureJavaVersion = '2.13.2'
reportDir = new File(project.projectDir as File, '/allure-report/ui')
resultsDir = new File(project.projectDir as File, '/allure-report/results')
clean = true
}
task createReportDir() {
doLast {
def file = new File(project.projectDir as File, '/allure-report/ui')
if (!file.exists()) {
file.mkdirs();
}
}
}
task saveHistory(type: Copy) {
from new File(project.projectDir as File, '/allure-report/ui/history')
into new File(project.projectDir as File, '/allure-report/results/history')
}
clean {
if (!System.getenv('CI')) {
delete "$projectDir/allure-report"
delete "$projectDir/allure-results"
}
}
// Execution Rules
tasks.runWebTests.dependsOn 'clean', 'build', 'createReportDir'
tasks.runWebTests.dependsOn 'clean', 'build', 'createReportDir'
tasks.runMobileTests.dependsOn 'clean', 'build', 'createReportDir'
tasks.runApiTests.dependsOn 'clean', 'build', 'createReportDir'
tasks.runCucumberWebTests.dependsOn 'clean', 'build', 'createReportDir'
tasks.runCucumberMobileTests.dependsOn 'clean', 'build', 'createReportDir'
tasks.build.mustRunAfter 'clean'
tasks.runWebTests.finalizedBy('allureReport')
tasks.runWebTests.finalizedBy('allureReport')
tasks.runMobileTests.finalizedBy('allureReport')
tasks.runApiTests.finalizedBy('allureReport')
tasks.runCucumberWebTests.finalizedBy('allureReport')
tasks.runCucumberMobileTests.finalizedBy('allureReport')