Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Testing Next.js Apps with Jest, Testing Library and Cypress
Rating: 4.4 out of 5(412 ratings)
4,734 students

Testing Next.js Apps with Jest, Testing Library and Cypress

Learn to test a real-world serverless React app with routes, authentication, database and more!
Created byBonnie Schulkin
Last updated 10/2024
English
English [Auto],Portuguese [Auto],

What you'll learn

  • Testing Next . js UI, API, routes, authentication and database interactions
  • When to use unit testing, integration testing and end-to-end testing -- and why!
  • Strategies for testing SSG, SSR, ISR and CSR (including cache updates and SWR revalidation intervals)
  • How to use a test database for tests that involve data fetching and mutations

Course content

10 sections116 lectures7h 56m total length
  • Introduction3:10

    Explore end-to-end testing of a Next.js app using Jest, Testing Library, and Cypress, covering UI, API, and auth flows with a test database and a concert ticket purchase scenario.

  • Course Technologies and Prerequisites3:08

    Explore the technologies and prerequisites for testing Next.js apps with Jest, React Testing Library, and Cypress, including two mock modules for authentication and a mock service worker for API responses.

  • create-next-app Using with-jest Example3:20

    Begin setting up jest and testing library with a Next.js template using create-next-app, and learn to run isolated component tests while installing dependencies.

  • First Next.js Test5:42

    Learn to test a Next.js app with jest and testing library by rendering the home component in pages/index, using path aliases, and running tests in watch mode.

  • Course Features: Code Quizzes and Side Notes2:38

    Explore course features like code quizzes and side notes to practice concepts, ask questions in the course Q&A, and review solutions together after pausing to type out code.

  • Guide to the Rest of the Course5:14

    Orient yourself to the course by reviewing testing definitions and philosophy, and the popular concert venue app used to practice Next.js testing with Jest, Testing Library, and Cypress.

Requirements

  • Next . js UI and API (particularly version 10+)
  • React components and hooks
  • RECOMMENDED: Jest, Testing Library for React, Cypress
  • HELPFUL: Mock Service Worker

Description

Learn how to test your Next.js app from top to bottom! Tests provide confidence that your Next.js app won't be released with embarrassing, costly bugs. Employers need developers who know how to write tests!


Comprehensive Next.js App Testing

This course teaches how to test all aspects of a Next.js application, including:

  1. UI unit tests

  2. API unit tests

  3. Next.js routes

  4. Cached pages

  5. Data updates (both to the cache and via SWR refresh interval)

  6. Authentication

  7. End-to-End tests for a complete user flow

The course uses a cross-section of testing technologies, featuring: 

  1. Jest

  2. React Testing Library

  3. Mock Service Worker

  4. Cypress

  5. Cypress Testing Library

You'll also learn a wide array of testing techniques, such as:

  1. Using a test database

  2. Environment variables

  3. Jest module mocking

  4. Testing definitions and tradeoffs (not necessarily a technique, but helpful in making decisions about what to test!)


Practice what you've learned

The course includes "code quizzes" -- challenges to write code based on the concepts you've just learned. For more concept-heavy sections (such as testing definitions and guidelines) the course provides multiple-choice quizzes.


Test a pre-written app

A Next.js app has already been written for the course, so the course content can focus on testing. The course tests a popular concert venue app called... Popular Concert Venue (the owners were apparently running low on creativity when they named the place). The app features shows from bands such as The Joyous Nun Riot and Avalanche of Cheese. Randomized, mad-libs style band descriptions and images add to the fun.


Proven Instructor

The instructor is a proven Udemy veteran, with reputation for clear explanations, Q&A responsiveness, conciseness, and useful practice activities. Here are some reviews from the instructor's other courses: 

  • A great course, probably the best testing course I've ever taken.

  • After watching other courses on the same topic, this is the first one that I'm actually excited to dig into.

  • This course exceeded all my expectations. It has the right amount between practice and theory. The teacher is amazing and thoughtful and she answers the students.

  • I have taken several courses on Udemy, and this is the best one where the teacher doesnt just lecture, but actually structures the class so that I learn the material.

Who this course is for:

  • Next . js developers who want to learn how to test all aspects of their app