Skip to content

Commit

Permalink
Added jacoco test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mghosh00 committed Jan 21, 2024
1 parent b411d3b commit 74b82b4
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'java'
id 'jacoco'
}

group 'org.example'
Expand All @@ -10,6 +11,7 @@ repositories {
}
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
sourceSets {
main {
Expand Down
42 changes: 42 additions & 0 deletions jacoco.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apply plugin: "jacoco"

jacoco {
toolVersion = '0.8.9'
reportsDirectory = layout.buildDirectory.dir('reports/jacoco')
}

jacocoTestReport {
dependsOn test
group = "reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.required = false
csv.required = false
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
sourceDirectories = fileTree(dir: 'src/main/RugbyWorldCup')
}

jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.5
}
}

rule {
enabled = false
element = 'CLASS'
includes = ['org.gradle.*']

limit {
counter = 'LINE'
value = 'TOTALCOUNT'
maximum = 0.3
}
}
}
}

build.dependsOn(jacocoTestReport)

0 comments on commit 74b82b4

Please sign in to comment.