Simplify Testing with React Testing Library: Create maintainable tests using RTL that do not break with changes
暫譯: 使用 React Testing Library 簡化測試:創建不因變更而中斷的可維護測試
Crump, Scottie
- 出版商: Packt Publishing
- 出版日期: 2021-05-14
- 售價: $1,670
- 貴賓價: 9.5 折 $1,587
- 語言: 英文
- 頁數: 246
- 裝訂: Quality Paper - also called trade paper
- ISBN: 1800564457
- ISBN-13: 9781800564459
-
相關分類:
React
海外代購書籍(需單獨結帳)
商品描述
A fast-paced, practical guide to helping you leverage React Testing Library to test the DOM output of components
Key Features:
- Get to grips with React Testing Library and create tests that don't break with changes in implementation
- Learn how to put RTL into practice by implementing it in real-world scenarios
- Test apps to be more accessible and ensure your tests will work with actual DOM nodes
Book Description:
React Testing Library (RTL) is a lightweight and easy-to-use tool for testing the document object model (DOM) output of components. This book will show you how to use this modern, user-friendly tool to test React components, reducing the risk that your application will not work as expected in production.
The book demonstrates code snippets that will allow you to implement RTL easily, helping you to understand the guiding principles of the DOM Testing Library to write tests from the perspective of the user. You'll explore the advantages of testing components from the perspective of individuals who will actually use your components, and use test-driven development (TDD) to drive the process of writing tests. As you advance, you'll discover how to add RTL to React projects, test components using the Context API, and also learn how to write user interface (UI) end-to-end tests using the popular Cypress library. Throughout this book, you'll work with practical examples and useful explanations to be able to confidently create tests that don't break when changes are made.
By the end of this React book, you will have learned all you need to be able to test React components confidently.
What You Will Learn:
- Explore React Testing Library and its use cases
- Get to grips with the RTL ecosystem
- Apply jest-dom to enhance your tests using RTL
- Gain the confidence you need to create tests that don't break with changes using RTL
- Integrate Cucumber and Cypress into your test suite
- Use TDD to drive the process of writing tests
- Apply your existing React knowledge for using RTL
Who this book is for:
This book is for software engineers, quality engineers and React developers who want to learn about modern practices used for testing React components using the latest testing tool, RTL. Basic knowledge of React development is required to get the most out of this book.
商品描述(中文翻譯)
一本快速且實用的指南,幫助您利用 React Testing Library 測試組件的 DOM 輸出
主要特點:
- 掌握 React Testing Library,創建不會因實現變更而中斷的測試
- 學習如何在實際場景中應用 RTL
- 測試應用程式以提高可及性,確保您的測試能與實際的 DOM 節點一起運作
書籍描述:
React Testing Library (RTL) 是一個輕量且易於使用的工具,用於測試組件的文檔物件模型 (DOM) 輸出。本書將向您展示如何使用這個現代且使用者友好的工具來測試 React 組件,降低您的應用程式在生產環境中無法如預期運作的風險。
本書展示的程式碼片段將使您能夠輕鬆實現 RTL,幫助您理解 DOM 測試庫的指導原則,從使用者的角度撰寫測試。您將探索從實際使用您組件的個體的角度測試組件的優勢,並使用測試驅動開發 (TDD) 來推動撰寫測試的過程。隨著進展,您將學會如何將 RTL 添加到 React 專案中,使用 Context API 測試組件,並學習如何使用流行的 Cypress 庫撰寫用戶界面 (UI) 的端到端測試。在整本書中,您將通過實用的範例和有用的解釋,能夠自信地創建不會因變更而中斷的測試。
在這本 React 書籍結束時,您將學會所有必要的知識,以自信地測試 React 組件。
您將學到的內容:
- 探索 React Testing Library 及其使用案例
- 掌握 RTL 生態系統
- 應用 jest-dom 來增強您使用 RTL 的測試
- 獲得創建不會因變更而中斷的測試所需的信心,使用 RTL
- 將 Cucumber 和 Cypress 整合到您的測試套件中
- 使用 TDD 來推動撰寫測試的過程
- 應用您現有的 React 知識來使用 RTL
本書適合誰:
本書適合希望學習使用最新測試工具 RTL 測試 React 組件的軟體工程師、品質工程師和 React 開發者。需要具備基本的 React 開發知識,以便充分利用本書的內容。