My goal is to setup a build pipeline as discussed in this movie, and I have been messing about with the first steps.
I have a project with some junit tests (reading/writing xml and stuff like that) and have moved my database tests to an integration test task.
However I am not trying to add Jacoco and have only found ways to run it on either test or integTest task. Is there a way to run it on both or is this not supposed to be used this way?
Currently my gradle.build script looks like this:
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = '1.0'
repositories {
mavenCentral()
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
jacoco {
toolVersion = "0.7.1.201405082137"
reportsDir = file("$buildDir/customJacocoReportDir")
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/jacocoHtml"
}
}
dependencies {
compile 'org.apache.poi:poi-ooxml:3.9'
compile 'javax.mail:mail:1.4.1'
compile fileTree(dir: 'libs', include: ['sqljdbc4.jar'])
integrationTestCompile 'junit:junit:4.12'
testCompile 'junit:junit:4.12'
}
jar {
manifest {
attributes 'Implementation-Title': 'Helper Classes',
'Implementation-Version': version
}
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integTest/java')
}
resources.srcDir file('src/integTest/resources')
}
}
task integrationTest(type: Test){
description = 'Run the integration tests.'
group = 'verification'
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
task jacocoIntegrationTestReport(type: JacocoReport){
sourceSets sourceSets.main
executionData integrationTest
}