/
build.gradle
83 lines (71 loc) · 2.27 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
plugins {
id 'groovy'
id 'java-gradle-plugin'
}
group = 'org.gradle.sample'
version = '1.0'
// tag::test-source-set[]
def integrationTest = sourceSets.create("integrationTest")
dependencies {
integrationTestImplementation(project)
}
// end::test-source-set[]
// tag::test-task[]
def integrationTestTask = tasks.register("integrationTest", Test) {
description = 'Runs the integration tests.'
group = "verification"
testClassesDirs = integrationTest.output.classesDirs
classpath = integrationTest.runtimeClasspath
mustRunAfter(tasks.named('test'))
}
tasks.named('check') {
dependsOn(integrationTestTask)
}
// end::test-task[]
def functionalTest = sourceSets.create("functionalTest")
dependencies {
functionalTestImplementation(project)
}
def functionalTestTask = tasks.register("functionalTest", Test) {
description = 'Runs the functional tests.'
group = "verification"
testClassesDirs = functionalTest.output.classesDirs
classpath = functionalTest.runtimeClasspath
mustRunAfter(tasks.named('test'), integrationTestTask)
}
tasks.named('check') {
dependsOn(functionalTestTask)
}
// tag::test-framework[]
repositories {
mavenCentral()
}
dependencies {
testImplementation platform("org.spockframework:spock-bom:2.2-groovy-3.0")
testImplementation 'org.spockframework:spock-core'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
integrationTestImplementation platform("org.spockframework:spock-bom:2.2-groovy-3.0")
integrationTestImplementation 'org.spockframework:spock-core'
integrationTestRuntimeOnly 'org.junit.platform:junit-platform-launcher'
functionalTestImplementation platform("org.spockframework:spock-bom:2.2-groovy-3.0")
functionalTestImplementation 'org.spockframework:spock-core'
functionalTestRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.withType(Test).configureEach {
// Using JUnitPlatform for running tests
useJUnitPlatform()
}
// end::test-framework[]
// tag::source-set-config[]
gradlePlugin {
testSourceSets(sourceSets.functionalTest)
}
// end::source-set-config[]
gradlePlugin {
plugins {
urlVerifierPlugin {
id = 'org.myorg.url-verifier'
implementationClass = 'org.myorg.UrlVerifierPlugin'
}
}
}