forked from znsio/teswiz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
206 lines (179 loc) · 6.4 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
import java.text.SimpleDateFormat
buildscript {
ext {
gradleVersion = '7.3.3'
assertJVersion = '3.24.2'
atdVersion = '13.1.2'
applitoolsSeleniumVersion = '5.63.0'
applitoolsAppiumVersion = '5.63.0'
commonsLang3Version = '3.12.0'
unirestVersion = '3.14.5'
jadbVersion = '1.2.1'
webDriverManagerVersion = '5.4.0'
junitVersion = '5.9.3'
slf4jVersion = '2.0.7'
fasterxmlJacksonVersion = '2.15.2'
jodaTimeVersion = '2.12.5'
masterThoughtVersion = '5.7.6'
browserStackLocalVersion = '1.1.0'
jetbrainsAnnotationsVersion = '24.0.1'
aspectJVersion = '1.9.19'
}
}
plugins {
id "org.sonarqube" version "4.2.1.3168"
id "java"
id "idea"
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'maven-publish'
id("io.freefair.aspectj.post-compile-weaving") version "8.0.1"
}
group = 'com.github.znsio'
version '0.0.82'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
mavenCentral()
maven {
url 'https://jitpack.io'
}
}
configurations {
cucumberRuntime {
extendsFrom testImplementation
}
}
compileJava {
options.encoding = "UTF-8"
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
dependencies {
implementation fileTree(dir: "$project.projectDir/libs", include: ['*.jar'])
implementation files("$buildDir/classes/main")
implementation files("$buildDir/classes/test")
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$project.fasterxmlJacksonVersion"
implementation "com.konghq:unirest-java:$project.unirestVersion"
implementation "org.assertj:assertj-core:$project.assertJVersion"
implementation "com.github.AppiumTestDistribution:AppiumTestDistribution:$project.atdVersion"
implementation "org.apache.commons:commons-lang3:$project.commonsLang3Version"
implementation "io.github.bonigarcia:webdrivermanager:$project.webDriverManagerVersion"
implementation "com.github.vidstige:jadb:$project.jadbVersion"
implementation "org.jetbrains:annotations:$project.jetbrainsAnnotationsVersion"
implementation "org.junit.jupiter:junit-jupiter:$project.junitVersion"
implementation "org.slf4j:slf4j-api:$project.slf4jVersion"
implementation "joda-time:joda-time:$project.jodaTimeVersion"
implementation "com.browserstack:browserstack-local-java:$project.browserStackLocalVersion"
implementation "com.applitools:eyes-appium-java5:$project.applitoolsAppiumVersion"
implementation "com.applitools:eyes-selenium-java5:$project.applitoolsSeleniumVersion"
implementation "net.masterthought:cucumber-reporting:$masterThoughtVersion"
implementation "org.aspectj:aspectjrt:$project.aspectJVersion"
}
shadowJar {
archiveBaseName.set("$project.name")
archiveClassifier.set('')
archiveVersion.set("$project.version")
zip64 true
manifest {
attributes "Main-Class": "com.znsio.e2e.runner.Runner"
}
}
tasks.register('sourcesJar', Jar) {
dependsOn classes
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
archives shadowJar
}
wrapper {
gradleVersion = project.gradleVersion // version from gradle.properties
}
publishing {
publications {
testing(MavenPublication) {
from components.java
artifact sourcesJar
}
}
}
tasks.register('install') { dependsOn publishToMavenLocal }
static def getCurrentDatestamp() {
Date today = new Date()
SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy")
return df.format(today)
}
static def getCurrentTimestamp() {
Date today = new Date()
SimpleDateFormat df = new SimpleDateFormat("HH-mm-ss")
return df.format(today)
}
tasks.register('run', JavaExec) {
doFirst {
def logDirectory = "target/" + getCurrentDatestamp() + "/" + getCurrentTimestamp()
println "Using LOG_DIR: $logDirectory"
System.setProperty "LOG_DIR", "$logDirectory"
def configFile = System.getenv("CONFIG")
if (null == configFile || !file(configFile).exists()) {
println("CONFIG file not provided, or does not exist")
println("Run the test by providing the CONFIG file not provided, or does not exist")
assert file(configFile).exists()
}
// You can also specify which config file to use based on the value of RUN_IN_CI as shown below
//
// def isRunInCI = Boolean.parseBoolean(System.getenv("RUN_IN_CI"))
// println "isRunningInCI: $isRunInCI"
// def configFile = isRunInCI
// ? "./configs/theapp_pcloudy_config.properties"
// : "./configs/theapp_local_android_config.properties"
// configFile = System.getenv("CONFIG") ? System.getenv("CONFIG") : configFile
systemProperties = System.properties as Map<String, ?>
def runnerArgs = [
"${configFile}",
"com/znsio/teswiz/steps",
"./src/test/resources/com/znsio/teswiz/features"
]
args = runnerArgs
println("Debug mode: " + System.getProperty('debug', 'false'))
// attach debugger
if (System.getProperty('debug', 'false') == 'true') {
println("In debug mode")
jvmArgs '-Xdebug', '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,' +
'address=*:5005'
}
}
mainClass = "com.znsio.teswiz.runner.Runner"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
}
test {
useJUnitPlatform()
outputs.upToDateWhen { false }
testLogging {
events "started", "passed", "skipped", "failed"
// show standard out and standard error of the test JVM(s) on the console
showStandardStreams = true
// show full exception trace
exceptionFormat = 'full'
showStackTraces = true
showCauses = true
showExceptions = true
}
// attach debugger
if (System.getProperty('debug', 'false') == 'true') {
jvmArgs '-Xdebug', '-agentlib:jdwp=transport=dt_socket,server=n,address=192.168.29.248:9009,suspend=y'
}
reports {
html.enabled(true)
junitXml.enabled(true)
html.destination(file("$buildDir/unit-test-results"))
junitXml.destination(file("$buildDir/unit-test-results"))
}
}
shadowJar.finalizedBy sourcesJar