Course Highlights
  • Write and structure unit & integration tests
  • Remove side effects from tests via mocking and spies
  • Work with popular JavaScript test runners and libraries
  • Write good tests and focus on testing core business logic

Overview

Why You Should Pursue this Course?

You will learn all the fundamentals of automated unit and integration testing using JavaScript in this course. You'll discover how to create and apply tests to your projects, as well as what kinds of things should and shouldn't be tested and how to test both straightforward and intricate code.

Throughout the course, you will learn about the setup and tools needed to develop automated tests. Additionally, sample projects will be given to you. Because this is a practical, hands-on course, you won't become bogged down in theory and will be able to understand all the important ideas through real-world examples.

Why You Need this Course

This course provides comprehensive instruction on the following topics:
  • Understanding the concepts of "testing" and "automated testing" and their significance.
  • Exploring the specifics of "unit testing."
  • Identifying the essential tools required to implement automated unit tests in your projects.
  • Learning the process of writing effective unit tests.
  • Initiating integration tests and getting started with the basics.
  • Formulating various expectations (assertions) in the testing context.
  • Following recommended patterns for writing tests.
  • Testing asynchronous and synchronous code proficiently.
  • Managing side effects through the use of spies and mocks.
  • Applying these concepts to real-world projects through practical examples.
Curriculum

8 Topics
Welcome To This Course!
What Is Testing?
Unit Testing: What & Why?
Unit vs Integration vs E2E Tests
A Quick Note About Test-Driven Development (TDD)
About This Course
Join Our Learning Community
Course Resources & Project Snapshots

5 Topics
Module Introduction
Which Tools Are Needed For Testing?
Jest & Vitest
Installing Vitest
Course Project Setup

19 Topics
Module Introduction
Basic Test File & Project Setup
Writing a First Test
Running Tests
Why Are We Testing?
The AAA Pattern - Arrange Act Assert
Keep Your Tests Simple!
Defining Behaviors & Fixing Errors In Your Code
Demo: Writing More Tests
Testing For Errors
Demo: Adding More Tests
Testing For Thrown Errors & Error Messages
Exercise: Problem
Exercise: Solution
Tests With Multiple Assertions (Multiple Expectations)
More Practice!
Introducing Test Suites
Adding Tests To Frontend & Backend Projects
Module Summary

9 Topics
Module Introduction
What To Test & Not To Test
Writing Good Tests - An Overview & Summary
Only Test "One Thing"
Splitting Functions For Easier Testing & Better Code
Refactoring Code
Formulating Different Expectations
A Word About Code Coverage
Module Summary

5 Topics
Module Introduction
Introducing Integration Tests
Writing an Integration Test & Reasoning
Testing For Errors
Integration vs Unit Tests: Finding the Right Balance

12 Topics
Module Introduction
toBe() vs toEqual()
The Problem With Asynchronous Code
Testing Asynchronous Code With Callbacks
Testing Asynchronous Code With Promises & async / await
Returning Promises In Tests
Getting Started with "Testing Hooks"
Why Hooks?
Using Testing Hooks (beforeEach beforeAll afterEach afterAll)
Concurrent Tests
Concurrency & Default Behavior
Module Summary

12 Topics
Module Introduction
The Starting Project
The Problem With Side Effects & Tests
Introducing Spies & Mocks
Working with Spies
Getting Started with Mocks & Automocking
Note on Mocking
Notes on Spies
Custom Mocking Logic
Managing Custom Mock Implementations Globally (__mocks__ Folder)
More Mocking Functionalities
Module Summary

11 Topics
Module Introduction
The Starting Project
Refresher: Practicing Basic Tests (1)
Refresher: Practicing Basic Tests (2)
Reasons to Mock
Mocking Global Values & Functions
Mocking Frontend Libraries
Test-specific Mocking Logic
Mocking In Selected Places
Using Local Mock Values
Module Summary

9 Topics
Module Introduction
Understanding the Problem
Working with Different Testing Environments
Setting up a Virtual HTML Page
Testing DOM Functionalities
DOM Tests & Cleanup Work
Finishing Example
A Brief Look at the "Testing Library" Package
Module Summary

2 Topics
Course Roundup
Bonus Lecture

  Write a Review

JavaScript Unit Testing - The Practical Guide

Go to Paid Course
Frequently Asked Questions
Your satisfaction is our priority. Should you find the course unsatisfactory, reach out to us within the initial 30 days of purchase, and we will promptly provide a full refund.
Because the course is fully self-paced, you can begin and end whenever is most convenient for you. You can change the learning rate to fit your schedule if you'd like.
You certainly can! You have lifetime access to the course upon enrolment so that you may review the material on any of your devices whenever you'd like.
The course begins immediately upon enrollment and remains accessible indefinitely. It is entirely self-paced, allowing you the flexibility to commence and conclude at your convenience.
Enjoy a lifetime of access! Upon enrollment, you have unrestricted access to the course, ensuring you can revisit the content whenever you wish on any of your devices.