-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
111 lines (96 loc) · 3.4 KB
/
build.gradle.kts
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
import org.gradle.internal.os.OperatingSystem
plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.8.21"
id("com.avast.gradle.docker-compose") version ("0.16.11")
id("io.qameta.allure") version ("2.11.2")
}
kotlin {
jvmToolchain(17)
}
group = "teamcity-tests"
version = "1.0.0"
description = "1.0.0"
repositories {
mavenCentral()
mavenLocal()
maven { setUrl("https://jitpack.io") }
maven { setUrl("https://packages.jetbrains.team/maven/p/teamcity-rest-client/teamcity-rest-client") }
}
val restAssuredVersion = "5.3.0"
val testngVersion = "7.7.1"
val selenideVersion = "6.12.2"
val allureVersion = "2.21.0"
dependencies {
// kotlin
testImplementation("org.jetbrains.kotlin:kotlin-stdlib")
testImplementation("org.jetbrains.kotlin:kotlin-reflect")
// teamcity-rest-client
testImplementation("org.jetbrains.teamcity:teamcity-rest-client:1.18.0")
// slf4j
testImplementation("org.slf4j:slf4j-api:1.7.36")
testImplementation("org.slf4j:slf4j-log4j12:1.7.36")
// General testing
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.testng:testng:$testngVersion")
testImplementation("io.rest-assured:rest-assured:$restAssuredVersion")
testImplementation("org.assertj:assertj-core:3.24.2")
// UI tests
testImplementation("com.codeborne:selenide-testng:$selenideVersion")
// Reporting
testImplementation("com.github.hibissscus:reportng:1.5.3")
testImplementation("io.qameta.allure:allure-testng:$allureVersion")
testImplementation("io.qameta.allure:allure-java-commons:${allureVersion}")
testImplementation("io.qameta.allure:allure-attachments:${allureVersion}")
testImplementation("io.qameta.allure:allure-generator:${allureVersion}")
testImplementation("io.qameta.allure:allure-httpclient:${allureVersion}")
testImplementation("io.qameta.allure:allure-selenide:$allureVersion")
implementation(kotlin("stdlib-jdk8"))
}
fun Test.testNG(desc: String, suite: String, reportngTitle: String = "test") {
description = desc
group = "verification"
ignoreFailures = true
outputs.upToDateWhen { false }
testLogging.showStandardStreams = true
reports.html.required.set(false)
reports.junitXml.required.set(false)
useTestNG {
suites(suite)
useDefaultListeners = false
listeners = setOf("testee.it.reportng.HTMLReporter")
systemProperties = mapOf(
"testee.it.reportng.title" to reportngTitle,
"allure.results.directory" to project.buildDir.toString() + "/allure-results"
)
}
}
tasks {
test {
testNG("run entire test suite locally", "src/test/resources/local.xml", "teamcity-tests-local")
}
}
tasks.register<Test>("docker") {
testNG("run entire test suite in docker", "src/test/resources/docker.xml", "teamcity-tests-docker")
}
allure {
version.set(allureVersion)
adapter {
autoconfigure.set(false)
aspectjWeaver.set(true)
frameworks {
testng {
enabled.set(true)
autoconfigureListeners.set(true)
}
}
}
}
dockerCompose {
useComposeFiles.add(
if (OperatingSystem.current() != null && OperatingSystem.current().toString().contains("aarch64"))
"docker-compose-arm.yml" else "docker-compose.yml"
)
stopContainers.set(false)
isRequiredBy(tasks.getByName("docker"))
}