Mô tả

Automated testing is a key concept in modern (web) development.

It is a concept that can be intimidating at first, hence many developers shy away from diving into testing and adding tests to their projects.

This course teaches you automated unit & integration testing with JavaScript from the ground up. You will learn how tests are written and added to your projects, what should (and should not) be tested and how you can test both simple as well as more complex code.

You will learn about the software and setup required to write automated tests and example projects will be provided as part of the course. It's a hands-on, practical course, hence you won't get stuck in theory - instead you'll be able to learn all key concepts at real examples.

In the course, Vitest will be used as the main testing library & tool. It's a modern JavaScript test runner and assertion library that provides Jest compatibility. Hence what you'll learn in this course will help you no matter if you're working with Vitest or Jest. And the core concepts will apply, no matter which testing setup you're using at all!

As part of this course, typical testing problems will be defined and solved and common strategies like mocking or working with spies are taught in great detail. This course also does not focus on specific types of JavaScript projects - neither does it focus on any specific library or framework.

Instead, you'll learn how to automatically test your (vanilla) JavaScript code, no matter if it's a NodeJS or frontend project. The fundamentals you'll gain in this course will help you in all your future projects - backend (NodeJS) and frontend (vanilla JS, React, Vue, Angular) alike.

This course will provide you with an extremely solid foundation to build up on, such that you can start adding tests to all your JavaScript projects.

In detail, this course will teach you:

  • What exactly "testing" or "automated testing" is (and why you need it)

  • What "unit testing" is specifically

  • Which tools you need to enable automated unit tests in your projects

  • How to write unit tests

  • How to get started with integration tests

  • How to formulate different expectations (assertions)

  • Which patterns to follow when writing tests

  • How to test asynchronous and synchronous code

  • How to deal with side effects with help of spies & mocks

  • How to apply all these concepts in real projects & examples

Bạn sẽ học được gì

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

Yêu cầu

  • Basic JavaScript knowledge is required
  • NO prior testing knowledge is necessary at all

Nội dung khoá học

10 sections

Getting Started

8 lectures
Welcome To This Course!
00:54
What Is Testing?
04:41
Unit Testing: What & Why?
04:33
Unit vs Integration vs E2E Tests
05:51
A Quick Note About Test-Driven Development (TDD)
01:35
About This Course
06:42
Join Our Learning Community
00:24
Course Resources & Project Snapshots
00:16

Setup & Testing Software

5 lectures
Module Introduction
01:09
Which Tools Are Needed For Testing?
06:27
Jest & Vitest
06:56
Installing Vitest
01:36
Course Project Setup
07:59

Testing Basics

19 lectures
Module Introduction
01:19
Basic Test File & Project Setup
07:04
Writing a First Test
06:54
Running Tests
04:18
Why Are We Testing?
03:02
The AAA Pattern - Arrange, Act, Assert
04:36
Keep Your Tests Simple!
01:34
Defining Behaviors & Fixing Errors In Your Code
07:38
Demo: Writing More Tests
04:36
Testing For Errors
04:14
Demo: Adding More Tests
03:28
Testing For Thrown Errors & Error Messages
04:58
Exercise: Problem
01:44
Exercise: Solution
04:46
Tests With Multiple Assertions (Multiple Expectations)
05:18
More Practice!
02:55
Introducing Test Suites
04:39
Adding Tests To Frontend & Backend Projects
03:36
Module Summary
02:22

Writing Good Tests

9 lectures
Module Introduction
01:25
What To Test & Not To Test
06:03
Writing Good Tests - An Overview & Summary
04:36
Only Test "One Thing"
02:02
Splitting Functions For Easier Testing & Better Code
05:01
Refactoring Code
10:13
Formulating Different Expectations
06:07
A Word About Code Coverage
00:38
Module Summary
02:01

Integration Tests

5 lectures
Module Introduction
00:57
Introducing Integration Tests
02:23
Writing an Integration Test & Reasoning
05:51
Testing For Errors
02:28
Integration vs Unit Tests: Finding the Right Balance
03:24

Advanced Testing Concepts

12 lectures
Module Introduction
01:06
toBe() vs toEqual()
04:21
The Problem With Asynchronous Code
06:13
Testing Asynchronous Code With Callbacks
05:02
Testing Asynchronous Code With Promises & async / await
04:32
Returning Promises In Tests
00:16
Getting Started with "Testing Hooks"
01:42
Why Hooks?
04:39
Using Testing Hooks (beforeEach, beforeAll, afterEach, afterAll)
06:13
Concurrent Tests
02:14
Concurrency & Default Behavior
00:24
Module Summary
01:48

Mocking & Spies: Dealing with Side Effects

12 lectures
Module Introduction
01:03
The Starting Project
04:11
The Problem With Side Effects & Tests
06:24
Introducing Spies & Mocks
02:07
Working with Spies
05:13
Getting Started with Mocks & Automocking
05:18
Note on Mocking
02:18
Notes on Spies
01:30
Custom Mocking Logic
07:51
Managing Custom Mock Implementations Globally (__mocks__ Folder)
06:11
More Mocking Functionalities
01:34
Module Summary
01:00

More on Mocking & Diving Deeper

11 lectures
Module Introduction
01:04
The Starting Project
03:02
Refresher: Practicing Basic Tests (1)
06:25
Refresher: Practicing Basic Tests (2)
04:43
Reasons to Mock
02:11
Mocking Global Values & Functions
08:13
Mocking Frontend Libraries
00:19
Test-specific Mocking Logic
06:59
Mocking In Selected Places
05:21
Using Local Mock Values
07:01
Module Summary
01:16

Testing & The DOM (Frontend JavaScript Testing)

9 lectures
Module Introduction
01:14
Understanding the Problem
03:58
Working with Different Testing Environments
03:42
Setting up a Virtual HTML Page
05:05
Testing DOM Functionalities
02:58
DOM Tests & Cleanup Work
03:12
Finishing Example
01:32
A Brief Look at the "Testing Library" Package
01:53
Module Summary
01:08

Course Roundup

2 lectures
Course Roundup
00:55
Bonus Lecture
00:16

Đánh giá của học viên

Chưa có đánh giá
Course Rating
5
0%
4
0%
3
0%
2
0%
1
0%

Bình luận khách hàng

Viết Bình Luận

Bạn đánh giá khoá học này thế nào?

image

Đăng ký get khoá học Udemy - Unica - Gitiho giá chỉ 50k!

Get khoá học giá rẻ ngay trước khi bị fix.