새 프로젝트 설정
- IntelliJ -> File -> New Project
- Gradle, Java, Web 체크 후 [Next]
- Name 설정 -> [Finish]
brew install gradle
build.gradle 수정
//[AS-IS]
plugins {
id 'java'
id 'war'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
... 생략
//[TO-BE]
plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
id 'war'
id 'jacoco'
}
group 'org.example'
version '1.0-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_1_8
jacoco {
toolVersion = '0.8.7'
}
//War 패키징 Task 미실행
bootWar.enabled = false
repositories {
mavenCentral()
}
dependencies {
implementation ('org.springframework.boot:spring-boot-starter-web')
testCompile('org.junit.jupiter:junit-jupiter-api')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine')
testImplementation ('org.springframework.boot:spring-boot-starter-test')
}
test {
useJUnitPlatform()
// finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
reports {
html.enabled true
xml.enabled true
csv.enabled true
html.destination file("$buildDir/jacoco/jacoco.html")
xml.destination file("$buildDir/jacoco/jacoco.xml")
}
// def Qdomains = []
// for (qPattern in '**/QA'..'**/QZ') {
// Qdomains.add(qPattern + '*')
// }
//
// afterEvaluate {
// classDirectories.setFrom(
// files(classDirectories.files.collect {
// fileTree(dir: it, excludes: [
// '**/BlogApplication*',
// '**/*Request*',
// '**/*Response*',
// '**/*Dto*',
// ] + Qdomains)
// })
// )
// }
finalizedBy 'jacocoTestCoverageVerification'
}
jacocoTestCoverageVerification {
def Qdomains = []
for (qPattern in '*.QA'..'*.QZ') {
Qdomains.add(qPattern + '*')
}
violationRules {
rule {
element = 'CLASS'
enabled = true
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.90
}
limit {
counter = 'METHOD'
value = 'COVEREDRATIO'
minimum = 0.90
}
/*
excludes = [
'**.*BlogApplication*',
'**.*Request*',
'**.*Response*',
'**.*Dto*',
] + Qdomains
*/
}
}
}
'프로그래밍 > OOP_Pattern_TDD' 카테고리의 다른 글
TDD Mockito 기초 사용법 (0) | 2022.08.26 |
---|---|
TDD - Junit4, Junit5 예외 테스트 방법 (0) | 2022.08.24 |
[Spring Boot] 테스트에 Spring Security 적용하기 (0) | 2022.08.08 |
TDD 기능 명세, 설계 (0) | 2022.08.05 |
TDD - Gradle 프로젝트에 JaCoCo & SonarQube 적용 (0) | 2022.08.05 |