-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: #19 스터디 목록 조회 API 수정 #20
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 ~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 👍
@@ -40,8 +41,8 @@ class StudyControllerTest { | |||
private ObjectMapper objectMapper; | |||
|
|||
@Test | |||
@DisplayName("스터디 컨트롤러의 studyList 메소드는 StudyResponse의 JSON Array룰 반환한다 ") | |||
void study_controller_study_list_return_json_array_of_study_response() throws Exception { | |||
@DisplayName("스터디 컨트롤러의 studyList 메소드는 StudyPageResponse룰 반환한다 ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유저는 존재하는 스터디를 최신순으로 10개씩 페이지별로 조회할 수 있다.
이런 식으로 서비스를 설명하는 명제로 테스트를 짓는게 좋을 것 같습니다
다른 사람 혹은 나중에 프로젝트에 투입된 사람도 무엇을 테스트하는지 쉽게 파악이 가능하고
테스트만 보고도 해당 프로젝트에 어떤 기능과 정책들이 있는지 파악할 수 있도록
(코드로 대화할 수 있도록) 테스트를 작성하는게 이상적이라고 생각합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DisplayName을 테스트하는 기능에 대해 최대한 잘 설명하는게 좋다고 저도 생각하기에 지금 명칭이 최선인 것 같진 않아요.
다만 단위테스트에서는 서비스가 아닌 모듈 하나의 동작을 테스트하는 거라 서비스에 대한 명제로 테스트를 명명하는 게 맞는 지 잘 모르겠습니다.
만약 테스트 명칭을 서비스에 대한 설명으로 짓게 된다면 하나의 서비스 기능과 관련된 컨트롤러 단위테스트, 서비스 단위테스트, 통합테스트 등 여러 테스트 명칭이 동일하게 될 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컨트롤러 테스트가 통합 테스트가 된다고 생각하고 있었는데 그럼 혹시 통합 테스트는 어떤식으로 진행될까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.pageNumber(0) | ||
.contents(serviceResponse) | ||
.build(); | ||
when(studyService.readStudy(any(Pageable.class))).thenReturn(studyPageResponse); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런식으로 Service를 모킹하면 테스트를 작성하는 의미가 떨어진다고 생각합니다.
실제로는 서비스가 틀린 응답값을 주고 있더라도 파악이 되지 않아요!
실제 MySQL을 구동하는 방식으로 테스트를 하는게 좋을 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상위 모듈(컨트롤러)의 단위테스트에서 종속 모듈(서비스)가 잘 작동하는 지 고려해야 한다는게 이해가 되지 않습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
위 대화가 해결 되면 자연스럽게 해결될 거 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 👍
작업 개요
관련 이슈
closed: #19
작업 사항
기존 API 응답
수정된 API 응답