-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
230 lines (181 loc) · 7.89 KB
/
Copy pathbuild.gradle
File metadata and controls
230 lines (181 loc) · 7.89 KB
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
plugins {
id 'java'
id "java-library"
id 'io.qameta.allure-report' version '2.9.6'
id 'se.thinkcode.cucumber-runner' version '0.0.8'
}
group = 'org.testapi'
version = '1.0-SNAPSHOT'
tasks.withType(Javadoc) {
repositories {
mavenCentral()
}
cucumber {
if (this.hasProperty("env")) {
System.setProperty("spring.profiles.active", "$env")
println "using environment $env"
}
main = 'io.cucumber.core.cli.Main'
glue = 'classpath:com.pintu.automation'
plugin = ['pretty', "json:build/cucumber.json", "html:build/result"]
// threads = 2
}
ext {
lombokVersion = "1.18.20"
restAssuredVersion = "4.4.0"
allureVersion = "2.17.3"
cucumberVersion = '7.2.3'
slackVersion = '1.20.2'
}
configurations {
compileOnly.extendsFrom annotationProcessor
testCompileOnly.extendsFrom compileOnly
testAnnotationProcessor.extendsFrom annotationProcessor
all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
cucumberRuntime {
extendsFrom testImplementation
}
}
dependencies {
// lombok
compileOnly group: "org.projectlombok", name: "lombok", version: '1.18.20'
annotationProcessor group: "org.projectlombok", name: "lombok", version: '1.18.20'
// slack
implementation group: 'com.slack.api', name: 'slack-api-client', version: slackVersion
// awaitility
implementation group: "org.awaitility", name: "awaitility", version: "4.1.0"
// restassured
implementation group: 'io.rest-assured', name: 'rest-assured', version: '4.4.0'
implementation group: 'io.rest-assured', name: 'json-schema-validator', version: '5.3.1'
// alure
implementation group: 'io.qameta.allure', name: 'allure-testng', version: '2.17.3'
implementation group: 'io.qameta.allure', name: 'allure-cucumber7-jvm', version: '2.17.3'
implementation group: 'io.qameta.allure', name: 'allure-rest-assured', version: '2.17.3'
// opencsv
implementation group: 'com.opencsv', name: 'opencsv', version: '5.5.1'
// apache
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
implementation group: 'commons-dbutils', name: 'commons-dbutils', version: '1.7'
implementation group: 'org.apache.httpcomponents.core5', name: 'httpcore5', version: '5.1.1'
// faker
implementation group: 'com.github.javafaker', name: 'javafaker', version: '1.0.2'
// jsonpath
implementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.8.0'
// jedis
implementation group: 'redis.clients', name: 'jedis', version: '3.6.3'
implementation 'org.slf4j:slf4j-api:2.0.7' // SLF4J API
implementation 'ch.qos.logback:logback-classic:1.2.3' //
//CUCUMBER + SELENIUM
// implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59'
// implementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.0'
// implementation group: 'io.cucumber', name: 'cucumber-java', version: '5.4.1'
// testImplementation group: 'io.cucumber', name: 'cucumber-junit', version: '5.4.1'
// implementation group: 'io.appium', name: 'java-client', version: '7.3.0'
// implementation group: 'io.rest-assured', name: 'rest-assured', version: '4.3.0'
// implementation group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '4.2.2'
// webdriver - will use later
// implementation group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '4.4.3'
// jsonsimple
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
// curl logger
implementation group: 'com.github.dzieciou.testing', name: 'curl-logger', version: '2.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
// testng
implementation group: "org.testng", name: "testng", version: "7.0.0"
// mariadb + mysql
implementation group: "org.mariadb.jdbc", name: "mariadb-java-client", version: "2.7.2"
// postgress sql
implementation group: 'org.postgresql', name: 'postgresql', version: '42.5.0'
// spot-connector
implementation 'io.github.binance:binance-spot:1.0.0'
// cucumber
compileOnly group: 'io.cucumber', name: 'cucumber-java', version: '7.2.3'
testImplementation group: 'io.cucumber', name: 'cucumber-java', version: '7.2.3'
compileOnly group: 'io.cucumber', name: 'cucumber-spring', version: '7.2.3'
//selenium
testImplementation 'io.cucumber:cucumber-java:7.6.0'
testImplementation 'io.cucumber:cucumber-junit:7.6.0'
testImplementation 'junit:junit:4.13.2'
// This dependency is used by the application.
implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'org.seleniumhq.selenium:selenium-java:4.4.0'
implementation 'io.github.bonigarcia:webdrivermanager:5.3.0'
// guava
implementation group: "com.google.guava", name: "guava", version: "30.1-jre"
// navixpath
implementation group: 'tech.navicore', name: 'navixpath', version: '1.0.0'
// okhttp
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.9.3'
//implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.12.4'
}
failOnError = false
}
test {
useTestNG() {
if (System.properties.containsKey("suiteXmlFile")) {
suites System.properties.get("suiteXmlFile")
} else {
// Default to the rest suite if no suite is specified
suites file('src/test/resources/testng-rest-suite.xml')
}
}
testLogging {
exceptionFormat "full"
}
options {
systemProperties(System.getProperties())
}
outputs.upToDateWhen { false } // always rerun the test
ignoreFailures = true
}
tasks.withType(JavaCompile) {
sourceCompatibility("11")
targetCompatibility("11")
options.encoding("UTF-8")
}
// https://stackoverflow.com/a/36130467 for test result log
tasks.withType(Test) {
testLogging {
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
configurations {
cucumberRuntime {
extendsFrom testImplementation
}
}
task cucumberCli() {
dependsOn assemble, testClasses
doLast {
javaexec {
def tags = getProperty("tags")
systemProperties(System.getProperties())
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = [
'--plugin', 'pretty',
'--plugin', 'html:build/test-results/html-report.html',
'--plugin', 'json:build/test-results/json-report.json',
'--plugin', 'io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm',
'--glue', 'src/test/java/web',
'--tags', tags,
'src/test/resources']
}
}
}
tasks.register("sendReportToSlack", JavaExec) {
it.dependsOn = List.of("assemble")
it.classpath = files(
sourceSets.main.getRuntimeClasspath()
)
it.mainClass = "commons.SlackCI"
}