React Testing Library
Simplify component testing with React Testing Library.
StartKey Concepts
Review core concepts you need to learn to master this subject
What is React Testing Library?
Installing RTL
RTL Render
getByX Queries
User Event
queryByX variant
findByX Variant
Jest Dom
What is React Testing Library?
What is React Testing Library?
React Testing Library (RTL) is a library for testing React applications. React Testing Library focuses on testing components from the end-user’s experience rather than testing the implementation and logic of the underlying React components.
React Testing Library
Lesson 1 of 1
- 1In this lesson, you will learn how to test your React components with the React Testing Library (RTL). React Testing Lib…
- 2In order to use React Testing Library, we will need to include the @testing-library/react package in our project by using npm like so: npm install @testing-library/react –save-dev Once we have …
- 3Now that we know how to set up RTL, we can finally start testing our React components. To do so, we first have to query for and extract the DOM nodes from our virtually rendered components. Then, w…
- 4Now that we know how to perform queries with .getByX methods, it is time for us to move on to the other query method variants. RTL has two other categories of query methods called .queryByX and .fi…
- 5So far we’ve learned how to query and extract the different DOM nodes from our React components. Now, it’s time for us to learn how to mimic user interactions e.g. clicking a checkbox, typing text,…
- 6In the previous exercise we’ve learned about the .findByX query methods that allows us to test components that render asynchronously. But what about components that disappear asynchronously? Look…
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory