Skip to content

Commit

Permalink
[#100] Jacoco gradle 설정 완료
Browse files Browse the repository at this point in the history
  • Loading branch information
JunRain2 committed Jun 7, 2024
1 parent bac08cf commit 3b8c591
Showing 1 changed file with 63 additions and 2 deletions.
65 changes: 63 additions & 2 deletions backend/memetory/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'org.springframework.boot' version '3.2.2'
id 'io.spring.dependency-management' version '1.1.4'
id 'com.google.cloud.tools.jib' version '3.4.1'
id 'jacoco'
}

group = 'com.example'
Expand Down Expand Up @@ -70,8 +71,67 @@ clean {
delete file('src/main/generated')
}

tasks.named('test') {
test {
useJUnitPlatform()
finalizedBy 'jacocoTestReport'
}

jacocoTestReport {
reports {
xml.required.set(false)
csv.required.set(true)
html.required.set(true)
}
def Qdomains = []

for (qPattern in '**/QA'..'**/QZ') {
Qdomains.add(qPattern + '*')
}

afterEvaluate {
classDirectories.setFrom(
files(classDirectories.files.collect {
fileTree(dir: it,
excludes: ["**/dto/**",
"**/exception/**",
"**/userInfo/**",
"com/example/memetory/MemetoryApplication.class"
] + Qdomains)
})

)
}

finalizedBy 'jacocoTestCoverageVerification'
}

jacocoTestCoverageVerification {
def Qdomains = []

for (qPattern in '*.QA'..'*.QZ') {
Qdomains.add(qPattern + '*')
}


violationRules {
rule {
enabled = true
element = 'CLASS'

limit {
counter = 'METHOD'
value = 'COVEREDRATIO'
minimum = 0.00
}

limit {
counter = 'INSTRUCTION'
value = 'COVEREDRATIO'
minimum = 0.00
}
excludes = [] + Qdomains
}
}
}

jib {
Expand All @@ -90,4 +150,5 @@ jib {
container {
jvmFlags = ['-Dspring.profiles.active=dev']
}
}
}

0 comments on commit 3b8c591

Please sign in to comment.