Testcontainers
1. Spring Boot 3.1+ ์๋ ์ค์
์์กด์ฑ ์ถ๊ฐ
// build.gradle
testImplementation "org.springframework.boot:spring-boot-testcontainers"
testImplementation "org.testcontainers:mysql"
testImplementation "org.testcontainers:junit-jupiter" // ์๋ ์ค์ ์ ํ์application-test.yml ์ค์
application-test.yml ์ค์ # application-test.yml
spring:
datasource:
# jdbc:tc:[๋ฐ์ดํฐ๋ฒ ์ด์ค์ข
๋ฅ]:[๋ฒ์ ํ๊ทธ]///[DB์ด๋ฆ]
url: "jdbc:tc:mysql:8.0.33:///testdb"
username: "test"
password: "test"
driver-class-name: "org.testcontainers.jdbc.ContainerDatabaseDriver"๋์ ๋ฐฉ์
2. ์๋ ์ค์ (@Testcontainers ๋ฐ @DynamicPropertySource)
@Testcontainers ๋ฐ @DynamicPropertySource)๊ณตํต ์ค์ (์ถ์ ํด๋์ค)
ํ
์คํธ ํด๋์ค ์ ์ฉ
Last updated