-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
build.gradle.kts
112 lines (93 loc) · 3.52 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
112
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
java
groovy
eclipse // optional (to generate Eclipse project files)
idea // optional (to generate IntelliJ IDEA project files)
kotlin("jvm") version "2.0.0"
}
repositories {
mavenCentral()
}
dependencies {
val junit4Version = "4.13.2"
val junitBomVersion = "5.11.0"
// Use junit-bom to align versions
// https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html#sec:bom_import
implementation(platform("org.junit:junit-bom:$junitBomVersion")) {
because("Platform, Jupiter, and Vintage versions should match")
}
// JUnit Jupiter
testImplementation("org.junit.jupiter:junit-jupiter")
// JUnit Vintage
testImplementation("junit:junit:$junit4Version")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine") {
because("allows JUnit 3 and JUnit 4 tests to run")
}
// JUnit Suites
testImplementation("org.junit.platform:junit-platform-suite")
// JUnit Platform Launcher + Console
testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because("allows tests to run from IDEs that bundle older version of launcher")
}
testRuntimeOnly("org.junit.platform:junit-platform-console") {
because("needed to launch the JUnit Platform Console program")
}
// Mainrunner
testImplementation("de.sormuras.mainrunner:de.sormuras.mainrunner.engine:2.1.4") {
because("executes Java programs as tests")
}
// jqwik
testImplementation("net.jqwik:jqwik:1.9.0") {
because("allows jqwik properties to run")
}
// Spek2
val spekVersion = "2.0.19"
testImplementation("org.spekframework.spek2:spek-dsl-jvm:$spekVersion")
testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:$spekVersion")
// Spock2
testImplementation("org.spockframework:spock-core:2.4-M4-groovy-4.0") {
because("allows Spock specifications to run")
}
testImplementation(platform("org.apache.groovy:groovy-bom:4.0.22")) {
because("use latest 4.x version of Groovy for maximum compatibility with new JDKs")
}
// Kotest
testImplementation("io.kotest:kotest-runner-junit5:5.9.1")
testRuntimeOnly("org.slf4j:slf4j-nop:2.0.13") {
because("defaulting to no-operation (NOP) logger implementation")
}
// TestNG
testImplementation("org.testng:testng:7.10.2") {
because("allows writing TestNG tests")
}
testRuntimeOnly("org.junit.support:testng-engine:1.0.5") {
because("allows running TestNG tests on the JUnit Platform")
}
}
tasks {
withType<JavaCompile>().configureEach {
options.release.set(8)
}
withType<KotlinCompile>().configureEach {
compilerOptions.jvmTarget = JVM_1_8
}
val consoleLauncherTest by registering(JavaExec::class) {
dependsOn(testClasses)
classpath = sourceSets.test.get().runtimeClasspath
mainClass.set("org.junit.platform.console.ConsoleLauncher")
args("execute")
args("--scan-classpath")
args("--include-classname", ".*((Tests?)|(Spec))$")
args("--details", "tree")
argumentProviders += objects.newInstance(ReportsDirArgumentProvider::class).apply {
reportsDir.set(layout.buildDirectory.dir("test-results"))
}
}
test {
// useJUnitPlatform() ... https://github.com/gradle/gradle/issues/4912
dependsOn(consoleLauncherTest)
exclude("**/*")
}
}