kotest 4

Kotest 6.x + Spring Boot 3.x에서 @Transactional 롤백이 안될 때

Kotest 6.x + Spring Boot 3.x에서 @Transactional 롤백이 안될 때문제 상황Spring Boot 3.5.15와 Kotest 6.2.1 환경에서 Repository 통합 테스트를 작성하던 중, 테스트 데이터가 롤백되지 않고 실제 DB에 계속 쌓이는 문제가 발생했습니다.@Tags("test")@SpringBootTest@ActiveProfiles("local", "test")@Transactional@ApplyExtension(SpringExtension::class)class ProductRepositoryTest( private val productRepository: ProductRepository,) : BehaviorSpec() { init { ..

kotest 관련 @Transactional rollback 안되는 이슈

test 코드의 상위 패키지 레벨에 아래 설정을 넣어준다. object KotestConfig : AbstractProjectConfig() { // rollback 관련 동작 안해서 아래 설정 추가 override fun extensions() = listOf(SpringTestExtension(SpringTestLifecycleMode.Root)) } https://kotest.io/docs/framework/project-config.html Project Level Config | Kotest Kotest is flexible and has many ways to configure tests, such as configuring the order of tests inside a spec, or h..

kotest 생성자 bean 주입 오류 - Specs must have a public zero-arg constructor

kotest에서 빈을 생성자 주입으로 쓰려고 하면, Specs must have a public zero-arg constructor 오류가 발생 할 수 있다. 이 때에는 kotest-extension-spring 모듈이 필요로 하다. kotest extension spring 라이브러리가 두개가 검색 되곤 하는데, 헷갈리면 안된다. 현재는 이야기가 다르다. https://github.com/kotest/kotest-extensions-spring 여기가 중단 되고, kotest project 하위로 들어갔다.현재 버전은 6.2.1 이 최신이다.kotest와 버전을 동일하게 가져가고 있다.https://kotest.io/docs/extensions/spring.html Spring | KotestKote..

Kotest 기본만 알아보자

kotest link: https://kotest.io Kotest is a flexible and elegant multi-platform test framework for Kotlin with extensive assertions and integrated property testing. Testing Styles junit 스타일 지원, JS에서 많이 사용하는 jest와 유사한 테스트 스타일 지원, goovy로 작성하는 spock과도 유사한 형태의 behavior test 스타일도 각기 모두 지원한다. 테스트 스타일 종류 Fun Spec(Scala) Describe Spec(JavaScript framework) Should Spec(kotest) String Spec(kotest) Behavior..

반응형