[react-testing-library] 테스트 코드 작성 시 Tip 2022.03.02 03:55 프로그래밍/testing 글 작성자: 망고좋아 반응형 🎯 테스트 코드 작성 시 Tip 테스트 코드를 3가지 관점으로 작성하면 쉽게 작성할 수 있다. 📝 Three “A”s test("renders Changed! if the button was clicked", () => { // Arrange render(<Greeting />); // Act const buttonElement = screen.getByRole("button"); userEvent.click(buttonElement); // Assert const outputElement = screen.getByText("Changed!"); expect(outputElement).toBeInTheDocument(); }); Arrange : 테스트 데이터와 테스트 조건 및 환경 설정을 준비 Act : 테스트해야 하는 로직 실행 Assets : 예상한 결과와 실행 결과를 비교 반응형 공유하기 URL 복사카카오톡 공유페이스북 공유엑스 공유 게시글 관리 구독하기기록의 힘 '프로그래밍 > testing' 카테고리의 다른 글 [react-testing-library] 유저 이벤트 (0) 2022.01.17 [react-testing-library] 쿼리의 우선순위 (0) 2022.01.17 [react-testing-library] react-testing-library란? (0) 2022.01.17 [Jest] Async assertion (0) 2022.01.17 [Jest] Assertion Matchers 활용 (0) 2022.01.17 댓글 공유하기 다른 글 댓글 댓글을 사용할 수 없습니다. 이 글 공유하기 구독하기 구독하기 카카오톡 카카오톡 라인 라인 트위터 트위터 Facebook Facebook 카카오스토리 카카오스토리 밴드 밴드 네이버 블로그 네이버 블로그 Pocket Pocket Evernote Evernote 다른 글 [react-testing-library] 유저 이벤트 [react-testing-library] 유저 이벤트 2022.01.17 [react-testing-library] 쿼리의 우선순위 [react-testing-library] 쿼리의 우선순위 2022.01.17 [react-testing-library] react-testing-library란? [react-testing-library] react-testing-library란? 2022.01.17 [Jest] Async assertion [Jest] Async assertion 2022.01.17 다른 글 더 둘러보기
댓글을 사용할 수 없습니다.