Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 스프링테스트
- MockMvc
- filterexpression
- compositekey
- 개발
- 스프링
- Spring
- 자바
- secondaryindex
- 오류
- javaspring
- DynamoDB
- 로드밸런서
- Java
- annotation
- EmbeddedId
- markerinterface
- partiql
- query
- Route53
- 테스트코드
- 다이나모디비
- 자바스프링
- testresttemplate
- 도메인
- Springsecurity
- awscloud
- IdClass
- awscli
- AWS
Archives
- Today
- Total
목록테스트 (1)
아장아장 개발 일기
Spring MockMvc와 TestRestTemplate 비교
mvc 구조로 이뤄진 프로젝트의 경우 mockMvc 템플릿을 사용해 테스트를 진행할 수 있습니다. mockMvc를 사용하기 전에 TestRestTemplate을 사용해 테스트를 시도했는데 spring security config때문에 로그인 페이지에서 302 에러가 표시되었습니다. 정확히 스프링 시큐리티의 httpSecurity configure의 loginform과 antMatcher로 권한 필터링하는 소스가 테스트하려는 소스로의 진입을 막는 것으로 파악했습니다. 이는 mockMvc 템플릿의 @WithMockUser, @WithUserDetails등의 어노테이션을 사용해 해결될 수 있습니다. 그렇다면 여기서 ‘TestRestTemplate을 @WithMockUser 혹은 @WithUserDetails와..
개발/Spring
2022. 4. 19. 10:58