Hi!
I’ve searched everywhere and found some answers to this question but i can’t get any of them to work.
I want to combine all test reports of a multi project build into one report. What i found was an example of the TestReport task that I’ve added to my root project. I basically copied the example that comes with the gralde 1.6 dist. It look like this:
subprojects {
def javaSrc = "java/src"
def javaTestSrc = "java/testsrc"
if (new File(project.projectDir, javaSrc).exists() ||
new File(project.projectDir, javaTestSrc).exists()) {
apply plugin: 'java'
apply plugin: 'eclipse'
sourceCompatibility = 1.6
targetCompatibility = 1.6
buildDir = new File(rootProject.projectDir, "gradleBuild/" +
project.projectDir.getAbsolutePath().replace(project.rootDir.getAbsolutePath(), ""))
repositories {
mavenLocal()
maven {
url "http://repository/nexus/content/groups/public"
}
mavenCentral()
}
test {
workingDir = rootProject.projectDir
testReport = false
}
dependencies {
testCompile 'junit:junit:4.11'
compile 'log4j:log4j:1.2.14'
compile 'org.mockito:mockito-all:1.9.0'
compile 'org.powermock:powermock-core:1.4.12'
compile 'org.powermock:powermock-api-mockito:1.4.12'
compile 'org.powermock:powermock-api-support:1.4.12'
compile 'org.powermock:powermock-module-junit4:1.4.12'
compile 'org.powermock:powermock-reflect:1.4.12'
compile 'org.powermock:powermock-module-junit4-common:1.4.12'
}
sourceSets {
main {
java { srcDir javaSrc }
resources { srcDir javaSrc }
}
test {
java { srcDir javaTestSrc }
resources { srcDir javaTestSrc }
}
}
}
}
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
def javaprojects = subprojects.findAll { project ->
project.plugins.hasPlugin('java')
}
reportOn javaprojects*.test
}
when I run the testReport the projects are built and tests are run, then a test fails and I get a message where I can find the report file, but there are no reports created where I expect them to be. Is it because the tests fail? Must all test run in order to combine them?
What am I doing wrong?