File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed
Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change 11plugins {
22 kotlin(" jvm" ) version " 1.9.23"
3+ jacoco
34}
45
56group = " com.usc.team"
@@ -34,7 +35,69 @@ dependencies {
3435
3536tasks.test {
3637 useJUnitPlatform()
38+ testLogging {
39+ showStandardStreams = true
40+ }
41+ finalizedBy(tasks.jacocoTestReport)
3742}
43+
44+ tasks.jacocoTestReport {
45+ dependsOn(tasks.test)
46+ reports {
47+ xml.required.set(true )
48+ csv.required.set(true )
49+ html.required.set(true ) // Added HTML report
50+ }
51+ doLast {
52+ println (" Coverage report: file://${layout.buildDirectory} /reports/jacoco/test/html/index.html" ) // Adds clickable report link after test
53+ }
54+ }
55+
56+ tasks.jacocoTestCoverageVerification {
57+ dependsOn(tasks.test)
58+ violationRules {
59+ classDirectories.setFrom(
60+ classDirectories.files.map {
61+ fileTree(it) {
62+ exclude(" **/models/**" )
63+ exclude(" **/di/**" )
64+ }
65+ }
66+ )
67+
68+ rule {
69+ limit {
70+ minimum = " 0.8" .toBigDecimal()
71+ }
72+ }
73+ rule {
74+ limit {
75+ counter = " LINE"
76+ value = " COVEREDRATIO"
77+ minimum = " 0.8" .toBigDecimal()
78+ }
79+ }
80+ rule {
81+ limit {
82+ counter = " BRANCH"
83+ value = " COVEREDRATIO"
84+ minimum = " 0.8" .toBigDecimal()
85+ }
86+ }
87+ rule {
88+ limit {
89+ counter = " METHOD"
90+ value = " COVEREDRATIO"
91+ minimum = " 0.8" .toBigDecimal()
92+ }
93+ }
94+ }
95+ }
96+
97+ jacoco {
98+ toolVersion = " 0.8.13"
99+ }
100+
38101kotlin {
39102 jvmToolchain(17 )
40103}
You can’t perform that action at this time.
0 commit comments