Skip to content

Instantly share code, notes, and snippets.

@th-deng
Last active January 5, 2022 06:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save th-deng/2305025adb695aecad19ad02faa72d97 to your computer and use it in GitHub Desktop.
Save th-deng/2305025adb695aecad19ad02faa72d97 to your computer and use it in GitHub Desktop.
Config JaCoCo report and violation rules
// groovy DSL
jacocoTestReport {
reports {
// 원하는 리포트를 켜고 끌 수 있습니다.
html.enabled true
xml.enabled false
csv.enabled false
// 각 리포트 타입 마다 리포트 저장 경로를 설정할 수 있습니다.
// html.destination file("$buildDir/jacocoHtml")
// xml.destination file("$buildDir/jacoco.xml")
}
}
jacocoTestCoverageVerification {
violationRules {
rule {
element = 'CLASS'
limit {
counter = 'BRANCH'
value = 'COVEREDRATIO'
minimum = 0.90
}
}
}
}
// kotlin DSL
tasks.jacocoTestReport {
reports {
// 원하는 리포트를 켜고 끌 수 있습니다.
html.isEnabled = true
xml.isEnabled = false
csv.isEnabled = false
// 각 리포트 타입 마다 리포트 저장 경로를 설정할 수 있습니다.
// html.destination = file("$buildDir/jacocoHtml")
// xml.destination = file("$buildDir/jacoco.xml")
}
}
tasks.jacocoTestCoverageVerification {
violationRules {
rule {
element = "CLASS"
limit {
counter = "BRANCH"
value = "COVEREDRATIO"
minimum = "0.90".toBigDecimal()
}
}
}
}
@nobel6018
Copy link

좋은 글 올려주셔서 감사합니다
따라서 설정하다가 Deprecated 된 내용이 있어 공유합니다

.isEnabled 가 Deprecated 되었습니다 (저는 gradle 7.2 버전에 kotlin DSL 사용하고 있습니다)

html.required.set(true)
xml.required.set(false)
csv.required.set(false)

로 사용하면 됩니다

Deprecated 내용입니다

* @deprecated Use {@link #getRequired()} instead. This method will be removed in Gradle 8.0.

getRequired()를 사용해달라고 합니다. Gradle 8.0에서는 없어진다고 합니다.

@th-deng
Copy link
Author

th-deng commented Aug 31, 2021

확인해 주셔서 고맙습니다!! 그 사이도 많이 바뀐 것 같군요. 정리해서 한번 업데이트를 해보겠습니다.
고맙습니다. =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment