-
Notifications
You must be signed in to change notification settings - Fork 2
fix: 테스트 코드 리팩토링 #71
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
fix: 테스트 코드 리팩토링 #71
The head ref may contain hidden characters: "fix-\uD14C\uC2A4\uD2B8-\uCF54\uB4DC-\uB9AC\uD329\uD1A0\uB9C1"
Conversation
이전 Initdata 형식의 가상 데이터 추가함
|
유닛 테스트의 전환은 결국 기존의 설계 방식을 바꿔야 하는 문제로 이어진다고 생각합니다. 여기엔 많은 시간이 발생할 것이기에 서비스가 돌아감에 있어서는 현재로서는 문제가 발생하지 않기 때문에 지금 상태로 유지하고, 최대한 빠르게 오픈하는게 좋을 것 같아요. |
동의합니다 |
| CompletedCoursesDomain data1 = | ||
| CompletedCoursesDomain.builder(). | ||
| userDomain(userDao.findByStudentId(19011684L).get()). | ||
| userDomain(userDao.findByStudentId(19111111L).get()). |
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.
19111111 학번은 해당 테스트 코드에서만 사용되는 학번인건가요??
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.
아하 클래스 레벨에 @Transactional 덕분에 나중에 롤백되는건가요?
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.
아하 클래스 레벨에
@Transactional덕분에 나중에 롤백되는건가요?
그렇습니다. 이전에 InitData에 Test에 필요한 DB 데이터를 미리 입력해 놓았다면, 리팩토링 후 @Transactional 을 통해 테스트 코드마다 필요한 데이터를 테스트 레벨에서만 존재하도록 수정하였습니다!
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.
오오 그러면 굳이 별도의 test DB를 쓰지 않아도 되겠네요! 테스트 방법 배워갑니다~ ㅎㅎ
🔧연결된 이슈
🛠️작업 내용
🤷♂️PR이 필요한 이유
InitData리팩토링으로 인해 DB의 테스트 데이터를 참조하던 테스트 코드가 작동하지 않는 문제가 발생하여, 테스트 코드에 맞는 더미데이터를 추가하여 테스트 코드를 리팩토링하였습니다.✔️PR 체크리스트