SpringFramework/JUnit Test
SpringBoot JUnit5 의존성 설정
lovineff
2020. 11. 24. 15:02
SpringBoot 2.1 이하의 버전의 경우
// junit5
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude module : 'junit'
}
testImplementation("org.junit.jupiter:junit-jupiter-api")
testCompile("org.junit.jupiter:junit-jupiter-params")
testRuntime("org.junit.jupiter:junit-jupiter-engine")
test {
useJUnitPlatform()
}
SpringBoot 2.2 이상의 버전의 경우
testImplementation("org.springframework.boot:spring-boot-starter-test")
test {
useJUnitPlatform()
}
Why?
org.springframework.boot:spring-boot-starter-test 의존성 추가시
SpringBoot 2.1 이하의 버전은 Junit4를 기본으로 사용함
SpringBoot 2.2 이상의 버전은 Junit5를 기본으로 사용함