
Learn what testing is and why we care, from software to products like mattresses and cars. See how testing increases confidence and reliability by meeting expected requirements and reducing defects.
Create a React application from the terminal, inspect the boilerplate, and verify components with React Testing Library by running npm run test to see a passing render test.
learn to test react applications by validating behavior over implementation, ensuring user-facing outcomes—type into inputs, submit, and see errors—regardless of underlying code.
Explore structure of a test block in React Testing Library using test with a description and callback, render the component, locate elements, and drive assertions with test driven development.
Learn to write the first React Testing Library test by rendering a component and asserting inputs are initially empty, using role or label text queries over test ids.
Create an email input within a bootstrap-styled form, adding a container, label, and input with form-control to make tests pass.
Practice implementing user event tests by typing into password and confirm password fields with React Testing Library, rendering the app, and asserting input values update accordingly.
Add a submit button and use state for live input of email, password, and confirm password, then validate the email with a validator library and show an invalid email error.
Create a reusable test helper to type into form fields and reduce duplicity in React Testing Library tests, refactoring tests to return input elements and streamline typing.
Organize tests with the describe block to group app component tests and error handling. Use before each, before all, after each, and after all inside a describe block to run setup code only for relevant tests.
Create a test block that renders the card with props, locate the image by alt text to avoid colliding images, and assert the source matches the card's image URL.
Students implement a card component that renders name, phone, email, and image from props, with a styled header and content, ensuring tests pass and preparing a heart toggle feature.
Test a card component’s heart button by asserting outlined or filled hearts based on a prop, and verify toggling with user events.
Perform manual testing by rendering the app's cards component, loading cat data from JSON, and interacting with each card to verify information and basic UI behavior on localhost.
Create a test for the pets component that renders five cards, use async/await with findAllByRole to wait for server data, and note that the initial test with getAllByRole is flawed.
Learn integration testing by evaluating how the pets, card and filter components interact within the parent pets component, distinguishing it from isolated unit testing.
Learn to use nested queries in the React Testing Library to select specific cards and mark them as favorites. Then filter by favorites and not favorites using within and getByRole.
Learn to make tests pass in a React Testing Library workflow by wiring update favorite state through cards, managing index-based updates, and syncing filter logic for favorites.
fix styling by updating the filter component, set a filter container to 20 percent width with centered text, and apply 80 percent width to each form select after importing filter.css.
React testing library is the most popular tool to test your React application. It is extremely simple and intuitive to use but the outcomes are very powerful. It helps increase confidence in your React application and thus when it is shipped to production, your end-users will have a bug-free experience. This course will teach you everything you need to learn to start utilizing this popular library. So hope on in and enjoy the ride.
What you will learn
- The best practice of how to test with React Testing Library
- The importance of testing
- Testing component that make HTTP requests
- Mocking requests with Mock Service Worker
- Finding the right element in your component
- Dealing with the context API in your tests
Engaging content
You don't just code along in this course, but you also apply what you learn with engaging course assignments. After learning a concept, you will then be prompted to use what you learned in a coding challenge. These coding challenges will help you internalize React Testing Library in your mind. It is highly recommended to actually do the challenges rather than treating them as a code along.
Instructor support
I will always do my best to answer any questions in the Q&A section of the course. You can also reach out to me on YouTube or Twitter.