-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] - BE 테스트 개선 스프링 컨텍스트 캐싱 최적화 (#625)
* refactor: 모든 서비스 테스트 스프링 부트 테스트 기반으로 통일 개 * refactor: IntegerationTest -> AbstractIntegrationTest 이름 변경 * refactor: 컨트롤러 테스트 구조 계층화 * refactor: 테스트 공통 로직 메서드명 변경 * refactor: 컨트롤러 테스트가 공통 로직을 사용하도록 추상화된 클래스 상속 * feat: 서비스 통합 테스트 추상 클래스 정의 * feat: 서비스 통합 테스트들이 추상화된 공통로직을 사용하도록 상속 * refactor: 사용하지 않는 애너테이션 제거 개선 * refactor: 불필요한 MockBean 제거 (MemberRepository, JwtTokenProvider) * refactor: MockBean 속성 접근 제어 수준 강화 (protected -> private)
- Loading branch information
Showing
22 changed files
with
165 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
backend/src/test/java/kr/touroot/global/AbstractControllerIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package kr.touroot.global; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.restassured.RestAssured; | ||
import kr.touroot.authentication.infrastructure.JwtTokenProvider; | ||
import kr.touroot.utils.DatabaseCleaner; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | ||
import org.springframework.boot.test.web.server.LocalServerPort; | ||
|
||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||
public abstract class AbstractControllerIntegrationTest extends AbstractIntegrationTest { | ||
|
||
@Autowired | ||
protected DatabaseCleaner databaseCleaner; | ||
@Autowired | ||
protected ObjectMapper objectMapper; | ||
@Autowired | ||
protected JwtTokenProvider jwtTokenProvider; | ||
|
||
@LocalServerPort | ||
protected int port; | ||
|
||
@BeforeEach | ||
protected void baseSetUp() { | ||
RestAssured.port = port; | ||
databaseCleaner.executeTruncate(); | ||
} | ||
} |
6 changes: 5 additions & 1 deletion
6
...va/kr/touroot/global/IntegrationTest.java → ...uroot/global/AbstractIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
backend/src/test/java/kr/touroot/global/AbstractServiceIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package kr.touroot.global; | ||
|
||
import kr.touroot.utils.DatabaseCleaner; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | ||
|
||
@SpringBootTest(webEnvironment = WebEnvironment.NONE) | ||
public abstract class AbstractServiceIntegrationTest extends AbstractIntegrationTest { | ||
|
||
@Autowired | ||
protected DatabaseCleaner databaseCleaner; | ||
|
||
@BeforeEach | ||
protected void baseSetUp() { | ||
databaseCleaner.executeTruncate(); | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
backend/src/test/java/kr/touroot/global/AcceptanceTest.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.