exclusionPattern을 사용해서 빼야한다.apply plugin: 'jacoco' jacoco { toolVersion = "0.7.5.201505241946" } test { jacoco { enabled = true destinationFile = file("${buildDir}/jacoco/jacoco.exec") // 기본은 ${buildDir}/jacoco/test.exec } }
destinationFile을 지정하면 안된다. 테스트 후 파일이 삭제돼 버려서 결과가 SonrQube로 전송이 안됨.jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/jacocoHtml")
}
}
./gradlew clean test jacocoTestReport
${buildDir}/reports/jacoco/test/html/index.html을 브라우저로 열어서 코드 커버리지 상태를 살펴볼 수 있다.