JUnit2 [SpringBoot] JUnit 테스트코드 - Service package com.seypak.study.intellij.service.impl; import com.seypak.study.intellij.data.dto.ProductDto; import com.seypak.study.intellij.data.entity.ProductEntity; import com.seypak.study.intellij.data.handler.impl.ProductDataHandlerImpl; import com.seypak.study.intellij.service.ProductService; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupi.. 2023. 8. 7. [SpringBoot] JUnit 설명 2. JUnit 모듈 설명 3. JUnit LifeCycle Annotation @Test, @BeforeEach, @AfterEach, @BeforeAll, @AfterAll 추가) @Disabled: 테스트를 실행하지 않게 설정하는 어노테이션 (@Ignored) 4. JUnit Main Annotation @SpringBootTest - 통합 테스트 용도로 사용됨 - @SpringBootApplication을 찾아가 하위의 모든 Bean을 스캔하여 로드 - 그 후 Test용 Application Context를 만들어 Bean을 추가하고, @MockBean을 찾아 교체 @ExtendWith - JUnit4에서 @RunWith로 사용되던 어노테이션이 변경 - 메인으로 실행될 Class를 지정할 수 있음.. 2023. 7. 28. 이전 1 다음