|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/testing-react-apps-with-react-testing-library-rtl/
课程评论:没有评论
Coursera 课程总结:使用 React Testing Library (RTL) 测试 React 应用 本课程将教授您如何使用 React Testing Library (RTL) 来测试 React 组件,并让您的测试覆盖率达到 100%。 **课程内容纲要:** * **测试驱动开发 (TDD) 原则:** 了解 TDD 的核心思想。 * **React Testing Library (RTL) 详解:** 认识 RTL,并了解其与 Enzyme 等其他 React 测试框架的区别。 * **Create React App (CRA) 工作原理:** 深入理解 CRA 的内部机制。 * **Jest 与 RTL 的结合:** 学习 Jest 如何协同 RTL 进行测试。 * **RTL 查询元素:** 掌握 `getBy`, `queryBy`, `findBy`, `getAllBy`, `queryAllBy`, `findAllBy` 等查询方法。 * **模拟用户交互:** * 使用 `fireEvent` API 模拟用户操作。 * 使用 `userEvent` API 模拟更真实的用户交互。 * **组件隔离测试(单元测试):** 学习如何独立测试 React 组件。 * **代码覆盖率与调试:** 了解如何查看代码覆盖率并进行调试。 * **第三方库 Mock:** 学习如何 Mock Axios 等第三方库,并进行 GET 请求的 Mock。 * **CRA 的常见陷阱:** 了解 CRA 中可能遇到的问题。 完成本课程后,您将掌握测试任何 React 组件所需的基础工具,并能够实现 100% 的测试覆盖率。祝您学习愉快,永不止步!
Welcome to testing React components with React Testing Library! In this course, you will learn lots of things. You will learn:The principles of Test Driven DevelopmentKnow what is React Testing Library (RTL) and its differences with Enzyme (another popular test framework for React)Understand how Create React App (CRA) works.Understand how Jest works with RTLHow to test with RTL and query elements with:getBy, queryBy, findBy, getAllBy, queryAllBy, findAllByHow to simulate user interaction with the fireEvent APIHow to simulate user interaction with the userEvent APITesting components in isolation (unit tests)Learn about coverage and debuggingHow to mock 3rd party libraries like Axios and mock a GET requestLearn about the pitfalls of CRAYou will have all the fundamental tools to test any React component and have that coverage at 100%!Have fun, and never stop learning!