forked from grails/grails-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration-test.gradle
51 lines (44 loc) · 1.67 KB
/
integration-test.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
// src: https://github.com/brunodecarvalho/gradle-plugins/blob/master/integration-test.gradle
// Add integration test source sets
sourceSets {
integrationTest { sourceSet ->
["java", "groovy", "scala", "resources"].each {
if (!sourceSet.hasProperty(it)) return
sourceSet."$it".srcDir file("src/integration-test/${it}")
}
}
}
// Setup dependencies for integration testing
dependencies {
integrationTestImplementation sourceSets.main.output
integrationTestImplementation sourceSets.test.output
integrationTestImplementation configurations.testCompileClasspath
integrationTestRuntimeOnly configurations.testRuntimeClasspath
}
// Define integration test task
task integrationTest(type: Test) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
reports.html.enabled = false
}
// Make sure 'check' task calls integration test
check.dependsOn integrationTest
// Merge test reports
task mergeTestReports(type: TestReport) {
destinationDir = file("$buildDir/reports/tests")
// These must point to the binary test results directory generated by a Test task instance.
// If Test task instances are specified directly, this task would depend on them and run them.
reportOn files("$buildDir/test-results/binary/test", "$buildDir/test-results/binary/integrationTest")
}
integrationTest.finalizedBy mergeTestReports
// IDE integration for IDEA. Eclipse plugin already handles all source folders.
idea {
module {
["java", "groovy", "scala", "resources"].each {
def srcDir = file("src/integration-test/$it")
if(srcDir.exists()) {
testSourceDirs += srcDir
}
}
}
}