SlideShare ist ein Scribd-Unternehmen logo
1 von 21
2022.08.09 서비스개발1팀 최준우
서비스개발랩 세미나
ParameterizedTest 와 ContextCaching
Index
• Readable
• ParameterizedTest
• @MethodSource
• Fast
• Standalone
• Context Caching
바람직한 테스트 코드란? (By Kent Beck)
읽기 쉬워야 한다. Readable
자동화 되어야 한다. Automated
빨라야한다. Fast
Link
Readable
Readable - Trouble Shooting
Problem
1. forEach, 변수사용 증가
2. 프로덕션 코드와 결합도 증가
Readable X
Automated X
Code Link
Readable - Trouble Shooting
Solution
1. 논리 조건 제거 (if, while, for, switch)
2. @ParameterizedTest 적용
3. 구현 세부 정보 보다는 최종 결과에 집중
Readable O
Automated O
Code Link
Readable - @ParameterizedTest
How to use
• Stream.of (
arguments(“테스트 데이터”),
arguments(“테스트 데이터”),
…
)
returnType : Stream<Arguments>
• Annotation 생성
• @ParameterizedTest
• @MethodSource(“provider 명”)
원하는 테스트 케이스 만큼 ROW 추가
0 0 0
1 2 3
2 4 6
• Provider Method 명 Mapping
Fast - StandAlone
Fast - StandAlone
StandAlone WebMVCTest
목적 단위 테스트 슬라이스 테스트
범위 Controller Spring MVC
컨텍스트 로딩 여부 N Y
어노테이션 Bean 생성 여
부
N N
• StandAlone : 하나 이상의 @Controller 인스턴스를 등록하고 최소한의 Spring MVC 인프라를 구성하여 사용할 수 있는 테스트
• WebMvcTest : Spring MVC 테스트에 초점을 맞춘 테스트
Fast - StandAlone
WebMvcTest vs StandAlone
Registered Bean Count = 218
Mocking Count = 19
Registered Bean Count = 0
Mocking Count = 4
Conclusion
MockBean의 개수가 줄어드는 효과
Spring Context Loading을 실행하지 않음으로써 성능 상의 이점
Controller에 대한 단위 테스트가 목적이라면 standAlone 권장
Fast - standAloneSetup
How to use
• 테스트 대상 Controller Mocking
• 각각의 테스트 실행 시 MockMvc에 standaloneSetup 설정
• standaloneSetup의 parameter에 테스트 대상 컨트롤러 지정
Simulation
standAlone
webMvcTest
Fast - Context Caching
Fast - Context Caching
Application
Context
Application
Context
Application
Context
Fast - Context Caching
Simulation (before)
Fast - Context Caching
Spring은 실행 시점에 테스트 구성에 따라 ApplicationContext 로딩
테스트 구성이 동일한 경우 Cache 에 담겨진 ApplicationContext 재 사용
테스트 구성이 같거나 비슷한 경우 같은 구성으로 묶어서 관리한다면 reload 을 피할 수 있다.
TestA
@Autowired
ServiceA
@Autowired
ServiceB
@Autowired
ServiceC
TestC
@Autowired
ServiceA
@Autowired
ServiceB
@Autowired
ServiceC
TestB
@Autowired
ServiceA
@Autowired
ServiceB
@Autowired
ServiceC
@Autowired
ServiceD
1 2 3
time
Fast - Context Caching
최초 로딩 후 reload X
1 2 3
AbstractTestConfig
@Autowired
ServiceA
@Autowired
ServiceB
@Autowired
ServiceC
@Autowired
ServiceD
TestA TestB TestC
time
time
Fast - Context Caching
Simulation (after)
Fast - Context Caching
Debug - DefaultCacheAwareContextLoaderDelegate
First Loading
ContextController02Test ContextController03Test
ContextController01Test ContextController03Test
Summary
• Readable, Automated
• 구현의 세부정보 보다는 최종 결과에 집중 (with @ParameterizedTest)
• Fast
• StandAlone - Unit Test
• Context Loading 제거
• Context Caching - Slice Test
• Context Loading 최소화
References
• https://docs.spring.io/spring-framework/docs/current/javadoc-
api/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilder.html
• https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests
• https://docs.spring.io/spring-framework/docs/3.0.0.M4/spring-framework-reference/html/ch15s02.html
• https://docs.spring.io/spring-framework/docs/current/reference/html/testing.html
• https://docs.microsoft.com/ko-kr/dotnet/core/testing/unit-testing-best-practices
• https://tidyfirst.substack.com/p/desirable-unit-tests
• https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.html
• https://www.youtube.com/watch?v=YdtknE_yPk4
• https://www.youtube.com/watch?v=jdlBu2vFv58&t=809s
• https://blog.naver.com/gngh0101/222782894218
Q & A

Weitere ähnliche Inhalte

Ähnlich wie ParameterizedTest 와 ContextCaching.pptx

[Hello world 오픈세미나]open api client개발
[Hello world 오픈세미나]open api client개발[Hello world 오픈세미나]open api client개발
[Hello world 오픈세미나]open api client개발NAVER D2
 
Meteor 0.3.6 Preview
Meteor 0.3.6 PreviewMeteor 0.3.6 Preview
Meteor 0.3.6 PreviewJuntai Park
 
Final 07.컨테이너 환경에서 모니터링 이슈와 해결 방안
Final 07.컨테이너 환경에서 모니터링 이슈와 해결 방안Final 07.컨테이너 환경에서 모니터링 이슈와 해결 방안
Final 07.컨테이너 환경에서 모니터링 이슈와 해결 방안Opennaru, inc.
 
[오픈소스컨설팅]Fault Tolerance Architecture by Netflix
[오픈소스컨설팅]Fault Tolerance Architecture by Netflix[오픈소스컨설팅]Fault Tolerance Architecture by Netflix
[오픈소스컨설팅]Fault Tolerance Architecture by NetflixJi-Woong Choi
 
Online service 계층별 성능 모니터링 방안
Online service 계층별 성능 모니터링 방안Online service 계층별 성능 모니터링 방안
Online service 계층별 성능 모니터링 방안중선 곽
 
[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance Tuning[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance TuningJi-Woong Choi
 
[오픈소스컨설팅]Performance Tuning How To
[오픈소스컨설팅]Performance Tuning How To[오픈소스컨설팅]Performance Tuning How To
[오픈소스컨설팅]Performance Tuning How ToJi-Woong Choi
 
AWS와 부하테스트의 절묘한 만남 :: 김무현 솔루션즈 아키텍트 :: Gaming on AWS 2016
AWS와 부하테스트의 절묘한 만남 :: 김무현 솔루션즈 아키텍트 :: Gaming on AWS 2016AWS와 부하테스트의 절묘한 만남 :: 김무현 솔루션즈 아키텍트 :: Gaming on AWS 2016
AWS와 부하테스트의 절묘한 만남 :: 김무현 솔루션즈 아키텍트 :: Gaming on AWS 2016Amazon Web Services Korea
 
웹서버 부하테스트 실전 노하우
웹서버 부하테스트 실전 노하우웹서버 부하테스트 실전 노하우
웹서버 부하테스트 실전 노하우IMQA
 
실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우 실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우 YoungSu Son
 
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링OpenStack Korea Community
 
Visual studio team system with agile tech days 2010
Visual studio team system with agile tech days 2010Visual studio team system with agile tech days 2010
Visual studio team system with agile tech days 2010준일 엄
 
AWS로 게임 런칭 준비하기 ::: 장준성, 채민관, AWS Game Master 온라인 시리즈 #4
AWS로 게임 런칭 준비하기 ::: 장준성, 채민관, AWS Game Master 온라인 시리즈 #4AWS로 게임 런칭 준비하기 ::: 장준성, 채민관, AWS Game Master 온라인 시리즈 #4
AWS로 게임 런칭 준비하기 ::: 장준성, 채민관, AWS Game Master 온라인 시리즈 #4Amazon Web Services Korea
 
AWS 신규 보안 서비스 - WAF. Inspector 등 (김용우) :: re:Invent re:Cap Webinar 2015
AWS 신규 보안 서비스 - WAF. Inspector 등 (김용우) :: re:Invent re:Cap Webinar 2015AWS 신규 보안 서비스 - WAF. Inspector 등 (김용우) :: re:Invent re:Cap Webinar 2015
AWS 신규 보안 서비스 - WAF. Inspector 등 (김용우) :: re:Invent re:Cap Webinar 2015Amazon Web Services Korea
 
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...Amazon Web Services Korea
 
우리 제품의 검증 프로세스 소개 자료
우리 제품의 검증 프로세스 소개 자료 우리 제품의 검증 프로세스 소개 자료
우리 제품의 검증 프로세스 소개 자료 SangIn Choung
 
JVM Memory And GC Tuning Workflow
JVM Memory And GC Tuning WorkflowJVM Memory And GC Tuning Workflow
JVM Memory And GC Tuning Workflow승린 이
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven DevelopmentChangHyeon Bae
 
Io t에서의 소프트웨어단위테스트_접근사례
Io t에서의 소프트웨어단위테스트_접근사례Io t에서의 소프트웨어단위테스트_접근사례
Io t에서의 소프트웨어단위테스트_접근사례SangIn Choung
 

Ähnlich wie ParameterizedTest 와 ContextCaching.pptx (20)

[Hello world 오픈세미나]open api client개발
[Hello world 오픈세미나]open api client개발[Hello world 오픈세미나]open api client개발
[Hello world 오픈세미나]open api client개발
 
Meteor 0.3.6 Preview
Meteor 0.3.6 PreviewMeteor 0.3.6 Preview
Meteor 0.3.6 Preview
 
Final 07.컨테이너 환경에서 모니터링 이슈와 해결 방안
Final 07.컨테이너 환경에서 모니터링 이슈와 해결 방안Final 07.컨테이너 환경에서 모니터링 이슈와 해결 방안
Final 07.컨테이너 환경에서 모니터링 이슈와 해결 방안
 
[오픈소스컨설팅]Fault Tolerance Architecture by Netflix
[오픈소스컨설팅]Fault Tolerance Architecture by Netflix[오픈소스컨설팅]Fault Tolerance Architecture by Netflix
[오픈소스컨설팅]Fault Tolerance Architecture by Netflix
 
Online service 계층별 성능 모니터링 방안
Online service 계층별 성능 모니터링 방안Online service 계층별 성능 모니터링 방안
Online service 계층별 성능 모니터링 방안
 
[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance Tuning[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance Tuning
 
[오픈소스컨설팅]Performance Tuning How To
[오픈소스컨설팅]Performance Tuning How To[오픈소스컨설팅]Performance Tuning How To
[오픈소스컨설팅]Performance Tuning How To
 
AWS와 부하테스트의 절묘한 만남 :: 김무현 솔루션즈 아키텍트 :: Gaming on AWS 2016
AWS와 부하테스트의 절묘한 만남 :: 김무현 솔루션즈 아키텍트 :: Gaming on AWS 2016AWS와 부하테스트의 절묘한 만남 :: 김무현 솔루션즈 아키텍트 :: Gaming on AWS 2016
AWS와 부하테스트의 절묘한 만남 :: 김무현 솔루션즈 아키텍트 :: Gaming on AWS 2016
 
Springmvc
SpringmvcSpringmvc
Springmvc
 
웹서버 부하테스트 실전 노하우
웹서버 부하테스트 실전 노하우웹서버 부하테스트 실전 노하우
웹서버 부하테스트 실전 노하우
 
실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우 실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우
 
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
 
Visual studio team system with agile tech days 2010
Visual studio team system with agile tech days 2010Visual studio team system with agile tech days 2010
Visual studio team system with agile tech days 2010
 
AWS로 게임 런칭 준비하기 ::: 장준성, 채민관, AWS Game Master 온라인 시리즈 #4
AWS로 게임 런칭 준비하기 ::: 장준성, 채민관, AWS Game Master 온라인 시리즈 #4AWS로 게임 런칭 준비하기 ::: 장준성, 채민관, AWS Game Master 온라인 시리즈 #4
AWS로 게임 런칭 준비하기 ::: 장준성, 채민관, AWS Game Master 온라인 시리즈 #4
 
AWS 신규 보안 서비스 - WAF. Inspector 등 (김용우) :: re:Invent re:Cap Webinar 2015
AWS 신규 보안 서비스 - WAF. Inspector 등 (김용우) :: re:Invent re:Cap Webinar 2015AWS 신규 보안 서비스 - WAF. Inspector 등 (김용우) :: re:Invent re:Cap Webinar 2015
AWS 신규 보안 서비스 - WAF. Inspector 등 (김용우) :: re:Invent re:Cap Webinar 2015
 
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...
 
우리 제품의 검증 프로세스 소개 자료
우리 제품의 검증 프로세스 소개 자료 우리 제품의 검증 프로세스 소개 자료
우리 제품의 검증 프로세스 소개 자료
 
JVM Memory And GC Tuning Workflow
JVM Memory And GC Tuning WorkflowJVM Memory And GC Tuning Workflow
JVM Memory And GC Tuning Workflow
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Io t에서의 소프트웨어단위테스트_접근사례
Io t에서의 소프트웨어단위테스트_접근사례Io t에서의 소프트웨어단위테스트_접근사례
Io t에서의 소프트웨어단위테스트_접근사례
 

Kürzlich hochgeladen

공학 관점에서 바라본 JMP 머신러닝 최적화
공학 관점에서 바라본 JMP 머신러닝 최적화공학 관점에서 바라본 JMP 머신러닝 최적화
공학 관점에서 바라본 JMP 머신러닝 최적화JMP Korea
 
JMP가 걸어온 여정, 새로운 도약 JMP 18!
JMP가 걸어온 여정, 새로운 도약 JMP 18!JMP가 걸어온 여정, 새로운 도약 JMP 18!
JMP가 걸어온 여정, 새로운 도약 JMP 18!JMP Korea
 
JMP 기능의 확장 및 내재화의 핵심 JMP-Python 소개
JMP 기능의 확장 및 내재화의 핵심 JMP-Python 소개JMP 기능의 확장 및 내재화의 핵심 JMP-Python 소개
JMP 기능의 확장 및 내재화의 핵심 JMP-Python 소개JMP Korea
 
JMP를 활용한 가속열화 분석 사례
JMP를 활용한 가속열화 분석 사례JMP를 활용한 가속열화 분석 사례
JMP를 활용한 가속열화 분석 사례JMP Korea
 
JMP를 활용한 전자/반도체 산업 Yield Enhancement Methodology
JMP를 활용한 전자/반도체 산업 Yield Enhancement MethodologyJMP를 활용한 전자/반도체 산업 Yield Enhancement Methodology
JMP를 활용한 전자/반도체 산업 Yield Enhancement MethodologyJMP Korea
 
실험 설계의 평가 방법: Custom Design을 중심으로 반응인자 최적화 및 Criteria 해석
실험 설계의 평가 방법: Custom Design을 중심으로 반응인자 최적화 및 Criteria 해석실험 설계의 평가 방법: Custom Design을 중심으로 반응인자 최적화 및 Criteria 해석
실험 설계의 평가 방법: Custom Design을 중심으로 반응인자 최적화 및 Criteria 해석JMP Korea
 
(독서광) 인간이 초대한 대형 참사 - 대형 참사가 일어날 때까지 사람들은 무엇을 하고 있었는가?
(독서광) 인간이 초대한 대형 참사 - 대형 참사가 일어날 때까지 사람들은 무엇을 하고 있었는가?(독서광) 인간이 초대한 대형 참사 - 대형 참사가 일어날 때까지 사람들은 무엇을 하고 있었는가?
(독서광) 인간이 초대한 대형 참사 - 대형 참사가 일어날 때까지 사람들은 무엇을 하고 있었는가?Jay Park
 
데이터 분석 문제 해결을 위한 나의 JMP 활용법
데이터 분석 문제 해결을 위한 나의 JMP 활용법데이터 분석 문제 해결을 위한 나의 JMP 활용법
데이터 분석 문제 해결을 위한 나의 JMP 활용법JMP Korea
 

Kürzlich hochgeladen (8)

공학 관점에서 바라본 JMP 머신러닝 최적화
공학 관점에서 바라본 JMP 머신러닝 최적화공학 관점에서 바라본 JMP 머신러닝 최적화
공학 관점에서 바라본 JMP 머신러닝 최적화
 
JMP가 걸어온 여정, 새로운 도약 JMP 18!
JMP가 걸어온 여정, 새로운 도약 JMP 18!JMP가 걸어온 여정, 새로운 도약 JMP 18!
JMP가 걸어온 여정, 새로운 도약 JMP 18!
 
JMP 기능의 확장 및 내재화의 핵심 JMP-Python 소개
JMP 기능의 확장 및 내재화의 핵심 JMP-Python 소개JMP 기능의 확장 및 내재화의 핵심 JMP-Python 소개
JMP 기능의 확장 및 내재화의 핵심 JMP-Python 소개
 
JMP를 활용한 가속열화 분석 사례
JMP를 활용한 가속열화 분석 사례JMP를 활용한 가속열화 분석 사례
JMP를 활용한 가속열화 분석 사례
 
JMP를 활용한 전자/반도체 산업 Yield Enhancement Methodology
JMP를 활용한 전자/반도체 산업 Yield Enhancement MethodologyJMP를 활용한 전자/반도체 산업 Yield Enhancement Methodology
JMP를 활용한 전자/반도체 산업 Yield Enhancement Methodology
 
실험 설계의 평가 방법: Custom Design을 중심으로 반응인자 최적화 및 Criteria 해석
실험 설계의 평가 방법: Custom Design을 중심으로 반응인자 최적화 및 Criteria 해석실험 설계의 평가 방법: Custom Design을 중심으로 반응인자 최적화 및 Criteria 해석
실험 설계의 평가 방법: Custom Design을 중심으로 반응인자 최적화 및 Criteria 해석
 
(독서광) 인간이 초대한 대형 참사 - 대형 참사가 일어날 때까지 사람들은 무엇을 하고 있었는가?
(독서광) 인간이 초대한 대형 참사 - 대형 참사가 일어날 때까지 사람들은 무엇을 하고 있었는가?(독서광) 인간이 초대한 대형 참사 - 대형 참사가 일어날 때까지 사람들은 무엇을 하고 있었는가?
(독서광) 인간이 초대한 대형 참사 - 대형 참사가 일어날 때까지 사람들은 무엇을 하고 있었는가?
 
데이터 분석 문제 해결을 위한 나의 JMP 활용법
데이터 분석 문제 해결을 위한 나의 JMP 활용법데이터 분석 문제 해결을 위한 나의 JMP 활용법
데이터 분석 문제 해결을 위한 나의 JMP 활용법
 

ParameterizedTest 와 ContextCaching.pptx

  • 1. 2022.08.09 서비스개발1팀 최준우 서비스개발랩 세미나 ParameterizedTest 와 ContextCaching
  • 2. Index • Readable • ParameterizedTest • @MethodSource • Fast • Standalone • Context Caching
  • 3. 바람직한 테스트 코드란? (By Kent Beck) 읽기 쉬워야 한다. Readable 자동화 되어야 한다. Automated 빨라야한다. Fast Link
  • 5. Readable - Trouble Shooting Problem 1. forEach, 변수사용 증가 2. 프로덕션 코드와 결합도 증가 Readable X Automated X Code Link
  • 6. Readable - Trouble Shooting Solution 1. 논리 조건 제거 (if, while, for, switch) 2. @ParameterizedTest 적용 3. 구현 세부 정보 보다는 최종 결과에 집중 Readable O Automated O Code Link
  • 7. Readable - @ParameterizedTest How to use • Stream.of ( arguments(“테스트 데이터”), arguments(“테스트 데이터”), … ) returnType : Stream<Arguments> • Annotation 생성 • @ParameterizedTest • @MethodSource(“provider 명”) 원하는 테스트 케이스 만큼 ROW 추가 0 0 0 1 2 3 2 4 6 • Provider Method 명 Mapping
  • 9. Fast - StandAlone StandAlone WebMVCTest 목적 단위 테스트 슬라이스 테스트 범위 Controller Spring MVC 컨텍스트 로딩 여부 N Y 어노테이션 Bean 생성 여 부 N N • StandAlone : 하나 이상의 @Controller 인스턴스를 등록하고 최소한의 Spring MVC 인프라를 구성하여 사용할 수 있는 테스트 • WebMvcTest : Spring MVC 테스트에 초점을 맞춘 테스트
  • 10. Fast - StandAlone WebMvcTest vs StandAlone Registered Bean Count = 218 Mocking Count = 19 Registered Bean Count = 0 Mocking Count = 4 Conclusion MockBean의 개수가 줄어드는 효과 Spring Context Loading을 실행하지 않음으로써 성능 상의 이점 Controller에 대한 단위 테스트가 목적이라면 standAlone 권장
  • 11. Fast - standAloneSetup How to use • 테스트 대상 Controller Mocking • 각각의 테스트 실행 시 MockMvc에 standaloneSetup 설정 • standaloneSetup의 parameter에 테스트 대상 컨트롤러 지정 Simulation standAlone webMvcTest
  • 12. Fast - Context Caching
  • 13. Fast - Context Caching Application Context Application Context Application Context
  • 14. Fast - Context Caching Simulation (before)
  • 15. Fast - Context Caching Spring은 실행 시점에 테스트 구성에 따라 ApplicationContext 로딩 테스트 구성이 동일한 경우 Cache 에 담겨진 ApplicationContext 재 사용 테스트 구성이 같거나 비슷한 경우 같은 구성으로 묶어서 관리한다면 reload 을 피할 수 있다. TestA @Autowired ServiceA @Autowired ServiceB @Autowired ServiceC TestC @Autowired ServiceA @Autowired ServiceB @Autowired ServiceC TestB @Autowired ServiceA @Autowired ServiceB @Autowired ServiceC @Autowired ServiceD 1 2 3 time
  • 16. Fast - Context Caching 최초 로딩 후 reload X 1 2 3 AbstractTestConfig @Autowired ServiceA @Autowired ServiceB @Autowired ServiceC @Autowired ServiceD TestA TestB TestC time time
  • 17. Fast - Context Caching Simulation (after)
  • 18. Fast - Context Caching Debug - DefaultCacheAwareContextLoaderDelegate First Loading ContextController02Test ContextController03Test ContextController01Test ContextController03Test
  • 19. Summary • Readable, Automated • 구현의 세부정보 보다는 최종 결과에 집중 (with @ParameterizedTest) • Fast • StandAlone - Unit Test • Context Loading 제거 • Context Caching - Slice Test • Context Loading 최소화
  • 20. References • https://docs.spring.io/spring-framework/docs/current/javadoc- api/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilder.html • https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests • https://docs.spring.io/spring-framework/docs/3.0.0.M4/spring-framework-reference/html/ch15s02.html • https://docs.spring.io/spring-framework/docs/current/reference/html/testing.html • https://docs.microsoft.com/ko-kr/dotnet/core/testing/unit-testing-best-practices • https://tidyfirst.substack.com/p/desirable-unit-tests • https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.html • https://www.youtube.com/watch?v=YdtknE_yPk4 • https://www.youtube.com/watch?v=jdlBu2vFv58&t=809s • https://blog.naver.com/gngh0101/222782894218
  • 21. Q & A