Testing React Applications with Big Nerd Ranch
Published by Pearson
Learn best practices for testing your React application from the nerds at Big Nerd Ranch
- Big Nerd Ranch provides industry-leading training on iOS, Android, and Web development to over 20,000 developers through bootcamps and best-selling Big Nerd Ranch Guides. They have been recognized as one of the top software training providers in the world by Training Industry.
- You’ll learn to test React Components with React Testing Library.
- You’ll learn to test with Cypress, one of the most effective tools for end-to-end testing.
Do you need to add tests to your React app? Do you want to feel more confident deploying to production or refactoring your code? This workshop will help you learn how to write tests and compare different options for testing your application. We will write unit tests, integration tests, and end-to-end tests for the code. These tests will help catch regressions early so you can feel more confident in your code base. This workshop includes demo code and labs.
What you’ll learn and how you can apply it
By the end of the live online course, you’ll understand:
- How to write unit tests with Jest
- How to use Mock Service Workers to mock the API
- How to select a testing technique
And you’ll be able to:
- Test components with React Testing Library
- Test your application with Jest
- Write end-to-end tests with Cypress
This live event is for you because...
- You are a React developer and want to learn best practices for testing your application.
- You want to compare options for testing your website.
- You are curious how React applications can be tested.
Prerequisites
- Experience writing small React applications
- Familiarity with ECMAScript 6 or above
Course Set-up
- Download NodeJS LTS, downloadable from Noedjs
- Download or clone the starter code repo (repo is empty now but we will populate prior to course start)
Recommended Preparation
- Watch: Learn React for Modern Web Applications by Shaun Wassell
- Read: React Programming: The Big Nerd Ranch Guide by Loren Klingman
Recommended Follow-up
- Watch: Full-Stack React by Shaun Wassell
- Read: React Programming: The Big Nerd Ranch Guide by Loren Klingman
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Overview of Testing Types (30 minutes):
- Talk through the various types of tests
- Compare when you might want to use each
Setup Tools (10 minutes):
- Get the source code from GitHub and have our demo application up and running
Unit Tests (30 minutes):
- Write unit tests for small components with React Testing Library
Q&A (5 minutes)
Break (5 minutes)
Mocking APIs (20 minutes):
- Mock out the API for our application so we can test the full application
Integration Tests (50 minutes):
- Write a full flow integration test for the application with React Testing Library
- Write an error scenario test
- Mock out console.error
Q&A (5 minutes)
Break (5 minutes)
Cypress Testing (50 minutes):
- Setup Cypress
- Write full flow happy path tests with Cypress
- Test out an error scenario
- Writing custom Cypress Commands
- Tips for avoiding flaky tests
Compare jest and Cypress Tests (15 minutes):
- See what changes to the application are caught by each test suite
Q&A (10 minutes)
Summary (5 minutes)
Your Instructor
Ashley Parker
Ashley Parker is a solution architect with Big Nerd Ranch, where she works with software teams to write clean, easy-to-read code and deliver products that enhance user experience. She has experience with multiple languages and frameworks, but primarily concentrates on front-end development and testing solutions. She promotes a collaborative team environment with a focus on mentorship.