Skip to content
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

[BE] 테스트 코드 리팩토링 #730

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import harustudy.backend.auth.util.JwtTokenProvider;
import harustudy.backend.member.domain.LoginType;
import harustudy.backend.member.domain.Member;
import harustudy.backend.participantcode.domain.GenerationStrategy;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import jakarta.servlet.http.Cookie;
Expand Down Expand Up @@ -48,15 +49,15 @@ class IntegrationTest {
@Autowired
protected MockMvc mockMvc;

@Autowired
private WebApplicationContext webApplicationContext;

@Autowired
private JwtTokenProvider jwtTokenProvider;

@Autowired
private TokenConfig tokenConfig;

@Autowired
protected GenerationStrategy generationStrategy;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요 GenerationStrategy를 다른 통합테스트에서도 participantCode를 생성하는데 사용했다면 IntegrationTest로 올려도 좋을 것 같습니다. 하지만 지금 저희 통합 테스트에서는 StudyIntegrationTest에서만 사용하는 것 같아 StudyIntegrationTest에서 관리하는 것이 괜찮을 것 같은데 어떻게 생각하시는지 궁금합니다 😃

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 저도 이 부분 고민했었는데,

현재는 IntegrationTest에서 모든 의존성이 드러나고 있어서 GenerationStrategy도 올리는게 낫지 않을까 생각을 했었습니다!
(매번 통합 테스트에서 어떤 의존성을 어디서 선언할지 고민하지 않아도 되고요)

그런데 이 부분은 저도 고민 많이 했던 내용이라, 팀 논의를 먼저 해보면 좋을 것 같아요!

@MockBean
private OauthClients oauthClients;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@
@SuppressWarnings("NonAsciiCharacters")
class StudyIntegrationTest extends IntegrationTest {

@Autowired
private ObjectMapper objectMapper;

@Autowired
private EntityManager entityManager;

@Autowired
private GenerationStrategy generationStrategy;

private Study study1;
private Study study2;
private MemberDto memberDto1;
Expand Down