-
Notifications
You must be signed in to change notification settings - Fork 143
/
build.gradle
executable file
·197 lines (160 loc) · 7.19 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
import com.github.sherter.googlejavaformatgradleplugin.GoogleJavaFormat
plugins {
id "com.github.sherter.google-java-format" version "0.9"
id "com.diffplug.spotless" version "6.19.0"
id "ua.eshepelyuk.ManifestClasspath" version "1.0.0"
}
apply plugin: "java"
repositories {
mavenCentral()
}
dependencies {
implementation "org.junit.jupiter:junit-jupiter:5.4.2"
implementation("io.qameta.allure:allure-cucumber4-jvm:$allureVersion")
implementation("org.jsoup:jsoup:$jsoupVersion")
implementation 'xmlunit:xmlunit:1.6'
testImplementation("io.qameta.allure:allure-java-commons:$allureVersion")
testImplementation("io.qameta.allure:allure-rest-assured:$allureVersion")
testImplementation("ru.yandex.qatools.allure:allure-java-adaptor-api:$allureJavaAdapterVersion")
implementation("io.github.prashant-ramcharan:courgette-jvm:$ioGithubPrashantRamcharan") {
exclude group: "org.testng", module: "testng"
exclude group: "org.yaml", module: "testng"
}
implementation("io.github.bonigarcia:webdrivermanager:$webdrivermanager")
implementation("org.seleniumhq.selenium:selenium-java:$seleniumhqVersion") {
exclude group: "com.google.guava", module: "guava"
}
implementation("org.awaitility:awaitility:$orgAwaitility")
testImplementation("org.awaitility:awaitility:$orgAwaitility")
testImplementation("com.google.truth.extensions:truth-java8-extension:$truthVersion") {
exclude group: "com.google.guava", module: "guava"
}
implementation("com.google.truth.extensions:truth-java8-extension:$truthVersion") {
exclude group: "com.google.guava", module: "guava"
}
implementation("org.projectlombok:lombok:$lombokVersion")
annotationProcessor("org.projectlombok:lombok:$lombokVersion")
testAnnotationProcessor("org.projectlombok:lombok:$lombokVersion")
implementation("com.google.guava:guava:$guavaVersion")
implementation("com.google.inject:guice:$guiceVersion")
implementation("io.cucumber:cucumber-guice:$cucumberVersion")
implementation("ch.qos.logback:logback-classic:$logBackVersion")
implementation("ch.qos.logback:logback-core:$logBackVersion")
implementation 'org.slf4j:slf4j-api:2.0.7'
implementation("com.github.javafaker:javafaker:$javaFakerVersion") { exclude module: "org.yaml" }
testImplementation group: "org.assertj", name: "assertj-core", version: assertjCore
implementation("io.rest-assured:rest-assured:$restAssured")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$jacksonDatatypeJdk8")
implementation("com.fasterxml.jackson.core:jackson-core:$jacksonDatatypeJdk8")
implementation group: "org.assertj", name: "assertj-core", version: assertjCore
implementation group: "com.fasterxml.jackson.core", name: "jackson-core", version: "2.8.8"
implementation group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: "2.8.8"
implementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: "2.8.8"
implementation group: 'org.jfree', name: 'jfreechart', version: '1.5.0'
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
implementation 'commons-beanutils:commons-beanutils:1.9.4'
implementation group: 'org.testng', name: 'testng', version: '7.8.0'
implementation 'com.opencsv:opencsv:5.7.1'
implementation 'org.apache.poi:poi:5.2.3'
implementation 'org.apache.poi:poi-ooxml:5.2.3'
implementation group: 'org.apache.poi', name: 'poi', version: '5.2.3'
implementation 'com.detectlanguage:detectlanguage:1.1.0'
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.9.3'
implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '2.11.5'
implementation group: 'com.github.cafdataprocessing', name: 'language-detection', version: '4.1.0-1206'
implementation group: 'org.apache.tika', name: 'tika-langdetect-optimaize', version: '2.6.0'
implementation group: 'org.apache.tika', name: 'tika-langdetect', version: '2.6.0', ext: 'pom'
implementation group: 'org.apache.tika', name: 'tika-core', version: '2.6.0'
implementation group: 'ru.yandex.qatools.ashot', name: 'ashot', version: '1.5.4'
implementation group: 'org.jdom', name: 'jdom', version: '2.0.2'
}
task format(type: GoogleJavaFormat) {
source "src/main"
source "src/test"
include "**/*.java"
}
tasks.withType(Test) {
maxParallelForks = (int) (Runtime.runtime.availableProcessors().intdiv(2) ?: 1)
systemProperties = System.getProperties() as Map<String, ?>
systemProperties.remove("java.endorsed.dirs") // needs to be removed from Java 9
}
task deleteLogbackXml(type: Delete) {
println "Removing logback XML file"
delete 'src/main/resources/logback.xml'
}
task copyLogbackXml(type: Copy) {
dependsOn deleteLogbackXml
println "Adding logback XML file"
boolean createLogsFile
try{
createLogsFile = System.getProperty("generateLogs").equalsIgnoreCase("true")
println "generateLogs is " + createLogsFile
}
catch (Exception any){
println "Unable to get generateLogs parameter, setting it to default false as Cucumber rerun is enabled"
createLogsFile = false
}
if(createLogsFile){
println "Enabling logs file generation"
from layout.buildDirectory.file("$rootDir/src/main/resources/logbackXMLS/logs/logback.xml")
into layout.buildDirectory.dir("$rootDir/src/main/resources")
}
else{
println "Using only console logs"
from layout.buildDirectory.file("$rootDir/src/main/resources/logbackXMLS/console/logback.xml")
into layout.buildDirectory.dir("$rootDir/src/main/resources")
}
}
task createReportFolderIfNotExist() {
def folder = new File("allureReports")
if (!folder.exists()) {
folder.mkdirs()
}
println "Removing old logs file"
delete("logs/file.log")
}
task startTests{}
//task printConfiguration(type: Exec) {
// // enable this to print on jenkins existing environment json configuration
// // commandLine "cat", "/srv/dockerdata/jenkins_new/sormas-files/envData.json"
//}
task copyToGeneratedReport(type: Copy) {
dependsOn "createReportFolderIfNotExist"
from file("allureReports/history")
into file("$buildDir/allure-results/history")
}
task copyAllureFiles(type: Copy) {
copy {
from file("src/test/resources/allurefiles/categories.json")
into file("$buildDir/allure-results")
}
copy {
from file("$buildDir/resources/test/allurefiles/environment.properties")
into file("$buildDir/allure-results")
}
}
task createAllureReport(type: Exec) {
workingDir "."
def isWindows = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows")
if (isWindows) {
commandLine "cmd", "/c", "allure.bat", "generate", "$buildDir/allure-results", "-c", "-o", "./allureReports"
} else {
commandLine "allure", "generate", "$buildDir/allure-results", "-c", "-o", "./allureReports"
}
}
test {
maxParallelForks = (int) (Runtime.runtime.availableProcessors().intdiv(2) ?: 1)
println("maxParallelForks : " + maxParallelForks)
testLogging.showStandardStreams = true
// Pass all properties
systemProperties = System.getProperties() as Map<String, ?>
systemProperties.remove("java.endorsed.dirs")
}
compileJava.dependsOn format
startTests.dependsOn deleteLogbackXml
deleteLogbackXml.finalizedBy copyLogbackXml
//startTests.dependsOn printConfiguration
startTests.finalizedBy copyToGeneratedReport
copyToGeneratedReport.finalizedBy test
test.finalizedBy copyAllureFiles
copyAllureFiles.finalizedBy createAllureReport