Skip to content

Commit

Permalink
Merge test reports of unit and integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasuharu Nakano committed Jun 3, 2015
1 parent 881c7bc commit 1766966
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
13 changes: 12 additions & 1 deletion gradle/integration-test.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,29 @@ dependencies {
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
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
testSourceDirs += srcDir
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import groovy.transform.CompileStatic
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.testing.Test
import org.gradle.api.tasks.testing.TestReport

/**
* Gradle plugin for adding separate src/integration-test folder to hold integration tests
Expand Down Expand Up @@ -61,10 +62,20 @@ class IntegrationTestGradlePlugin implements Plugin<Project> {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
maxParallelForks = 1
reports.html.enabled = false
}.shouldRunAfter test

check.dependsOn integrationTest

task(type: TestReport, 'mergeTestReports') {
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

if(ideaIntegration) {
project.afterEvaluate {
if(project.convention.findByName('idea')) {
Expand Down

0 comments on commit 1766966

Please sign in to comment.