Skip to content

Commit 26af85b

Browse files
authored
�fix: 테스트 커버리지 설정 추가 (#22)
- build.gradle에 Jacoco 관련 설정 추가
1 parent 315d6f7 commit 26af85b

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

build.gradle

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ dependencies {
6161
tasks.named('test') {
6262
useJUnitPlatform()
6363
jvmArgs("-XX:+EnableDynamicAgentLoading")
64+
finalizedBy 'jacocoTestReport'
6465
}
6566

6667
def jacocoDir = layout.buildDirectory.dir("reports/")
@@ -71,7 +72,6 @@ for (qPattern in '*.QA'..'*.QZ') { // qPattern = '*.QA', '*.QB', ... '*.QZ'
7172
}
7273

7374
def jacocoExcludePatterns = [
74-
// 측정 안하고 싶은 패턴
7575
'**/*Application.class',
7676
'**/*Config*',
7777
'**/*Exception*',
@@ -85,13 +85,30 @@ def jacocoExcludePatterns = [
8585
'**/domains/*',
8686
]
8787

88+
def jacocoExcludePatternsForVerify = [
89+
'*.*Application*',
90+
'*.*Config*',
91+
'*.*Exception*',
92+
'*.*Request*',
93+
'*.*Response*',
94+
'*.*Entity*',
95+
'*.*Dto*',
96+
'*.jwt.*',
97+
'*.auth.*',
98+
'*.domain.*',
99+
'*.domains.*',
100+
]
101+
88102
jacocoTestReport {
89103
dependsOn test
90104

91105
reports {
92-
xml.required = true
93-
html.required = true
94-
csv.required = false
106+
html.required.set(true)
107+
xml.required.set(true)
108+
csv.required.set(true)
109+
html.destination jacocoDir.get().file("jacoco/index.html").asFile
110+
xml.destination jacocoDir.get().file("jacoco/index.xml").asFile
111+
csv.destination jacocoDir.get().file("jacoco/index.csv").asFile
95112
}
96113

97114
afterEvaluate {
@@ -122,7 +139,7 @@ jacocoTestCoverageVerification {
122139
minimum = 0.60
123140
}
124141

125-
excludes = jacocoExcludePatterns + QDomains
142+
excludes = jacocoExcludePatternsForVerify + QDomains
126143
}
127144
}
128145
}
@@ -138,6 +155,6 @@ sonar {
138155
property 'sonar.test.exclusions', jacocoExcludePatterns.join(',')
139156
property 'sonar.test.inclusions', '**/*Test.java'
140157
property 'sonar.java.coveragePlugin', 'jacoco'
141-
property 'sonar.coverage.jacoco.xmlReportPaths', jacocoDir.get().file("tests/test/index.xml").asFile
158+
property 'sonar.coverage.jacoco.xmlReportPaths', jacocoDir.get().file("jacoco/index.xml").asFile
142159
}
143160
}

0 commit comments

Comments
 (0)