React - testing

Testing react applications with Jest and React Testing Library

4.33 (233 reviews)
Udemy
platform
English
language
Software Testing
category
1,109
students
5 hours
content
Jan 2021
last update
$54.99
regular price

What you will learn

Testing React application

Jest framework

React Testing Library

Description

This course is not just a theory and bullet points about testing React. In this course, we test real application and you will gain not just knowledge but also practice.

We will focus on testing web application in React. I will explain why it's worth testing and what tools we should pick for testing react application. We will be talking about many different aspects of testing: Unit tests, integration tests, snapshots, test runner, describe, before and after tests, skip tests, loops, matchers, truthy and falsy, render component, fire event, mocking, fetching API, act, wait and many more. After this tutorial, you will be able to handle many obstacles with testing the dynamic applications in React. We will write a lot of different tests to cover different technics and ways to select certain elements and interact with them.

The first tool that we will learn will be Jest. I will show you how to run tests and write them. At this level, we will write tests without React application. We will focus on Jest only and use it as our test runner.

After we will know what is Jest and how it works, we will install our first application with React Testing Library. I will show you how that library works and what options do we have with it. We will render our components and we will trigger different events.

The main section of this tutorial will be testing the real React app. We will have a ready app, written in React and we will start using different technics to test our components. We will be using the newest trends in React like hooks with useState and useEffect. When you finish that chapter, you will know what kind of problems you might have when writing your own tests for React and more importantly, how to solve them with Jest and React Testing Library.

Content

Introduction

Testing tools
Setting up environment

Jest

Test runner
Keywords
Testing variables and functions
Before and after tests
Skip, only and timeout
Loops in tests
Matchers
Truthy and Falsy
Testing errors

React Testing Library

Introduction to react testing library
Component test
First test with render
Information available on the element
Methods to select elements
Fire event
Changing state

Testing real app

Installing the app
Preparing tests for component
Snapshot
Should display text
Checking ratings
Testing mouse events
Mocking
Testing form elements
Input values
SpyOn and wait
Mock fetch
Mock function arguments
Testing parent component
Act function
Testing errors
Testing list and button
Clicking on elements

Summary

Next steps

Screenshots

React - testing - Screenshot_01React - testing - Screenshot_02React - testing - Screenshot_03React - testing - Screenshot_04

Reviews

Ameen
August 21, 2023
If you have a basic idea about unit testing, like working with plain JS unit testing then this is sufficient to practice and get started with testing React components.
Sanja
June 30, 2023
I loved the course, it taught me everything I needed to know to start testing my React apps. Definitely recommended.
Mantas
January 16, 2022
Nice course. I liked the pace and the material is structured really well. I finally have proper understanding of the subject, thank you!
Fero
August 29, 2021
To the point and easy to follow. I did get a little lost towards the end but that's on me, not the instructor. Thank you very much.
Jhon
July 22, 2021
It is a cool program, the first in Udemy which I see with value, besides testing my own app, doesn't find match with the explanations, because my app useContext and hooks, which after the course I don't know how to manage
Ira
April 29, 2021
Great course. Easy for understanding and diving into unit testing with the react testing library. I fully recommend!
Cips
March 5, 2021
Pros: - modern testing tools - following good practices of react testing library - testing unexpectedly useful, common real life scenarios (at least from my experience) - Good explanations of what the functions that are used do - Good practices on using jest - The code is clean and well structured - Valuable testing insights - The course is engaging and learned alot - UP TO DATE! npm packages, big plus - no deprecations - I really like the fact that the teacher gives hints of what should you do in different but similar situations you might encounter in testing your projects Cons: - The teacher goes a bit too fast for my liking but not too fast - Some concepts are a bit hard to understand from the explanations but thats kinda understandable, you need to look in the docs as well to understand the most - the app is using authentication but thats not really tested - lesson 30 is a bit confusing for me - the python cli command is not working for me (windows) so no backend api thus cant login in the app - you dont need to see the app if you understand the code tho - the english accent is a bit off but so is mine :) The cons as bad as they sound like arent really that bad, if you just pay attention to the course content you probably won't care about them. I recommend this course to beginners in testing react components for sure - its a good start :)

Charts

Price

React - testing - Price chart

Rating

React - testing - Ratings chart

Enrollment distribution

React - testing - Distribution chart

Related Topics

3643576
udemy ID
11/18/2020
course created date
2/6/2021
course indexed date
Bot
course submited by