Testing Fundamentals [EpicWeb]
In this workshop, Artem Zakharchenko, testing expert and creator of the Mock Service Worker API mocking library, will guide you through creating your own version of the Vitest testing framework.
Building a testing framework from scratch will give you a deep understanding of how the pieces fit together, and change the way you think about testing for the better.
More
What You'll Learn
The workshop is broken out into four parts, each with its own challenges and exercises that build upon the last:
Principles
First, you'll explore the principles and mental models that underlie testing strategies. This is where you will begin to distinguish between the intention of your code and its implementation details. When you focus the intention of what your code should accomplish, you can write tests that are more resilient to change.
Test Structure
Next, you'll do a deep dive into the structure of the testing framework. You'll create your own expect and test functions, configure your test environment, and use hooks to manage side effects in your tests.
Testing Asynchronous Code
Testing asynchronous code requires a slightly different approach when compared to testing synchronous code. Here you'll practice with testing promises and async functions, as well as handling errors and rejections.
Moving to Vitest
Once you've learned the fundamentals of testing and built your own mini-framework, you will migrate your tests to the Vitest framework. This process will cement your understanding of not just the "hows", but also the "whys" of testing.
Who This Workshop Is For
This workshop is for developers who have some testing experience, but feel like they're missing the bigger picture. If you're tired of writing tests that feel like a chore, and want to understand how to write tests that are actually useful, this workshop is for you.
Watch Online Testing Fundamentals [EpicWeb]
# | Title | Duration |
---|---|---|
1 | Testing Fundamentals Workshop Introduction | 01:44 |
2 | Overview of Testing Principles | 01:11 |
3 | Write an Intentional Test - PROBLEM | 01:06 |
4 | -----Ignore this video------- | 27:31 |
5 | Implement the Automated Greeting Test - SOLUTION | 01:15 |
6 | Debugging Intent vs. Implementation - PROBLEM | 00:41 |
7 | -----Ignore this video------- | 27:31 |
8 | Trusting Your Test - SOLUTION | 00:28 |
9 | Testing Principles Outro | 00:15 |
10 | Structure Your Tests | 00:56 |
11 | Imperative vs. Declarative Assertions - PROBLEM | 01:08 |
12 | -----Ignore this video------- | 27:31 |
13 | Implement a Declarative API - SOLUTION | 02:01 |
14 | Isolating Tests with Test Blocks - PROBLEM | 00:59 |
15 | -----Ignore this video------- | 27:31 |
16 | Create Test Blocks for Better Organization - SOLUTION | 01:27 |
17 | Move Tests into Modules - PROBLEM | 00:55 |
18 | -----Ignore this video------- | 27:31 |
19 | Modular Tests and Global Helpers - SOLUTION | 03:23 |
20 | Handle Test Side Effects - PROBLEM | 01:26 |
21 | -----Ignore this video------- | 27:31 |
22 | Implement Hooks for Test Setup & Cleanup - SOLUTION | 03:52 |
23 | Test Structure Recap | 00:23 |
24 | Overview of Testing Async Code | 00:48 |
25 | Handling Promises in Tests - PROBLEM | 01:24 |
26 | -----Ignore this video------- | 27:31 |
27 | Awaiting Async Tests - SOLUTION | 01:55 |
28 | Error Assertions for Rejected Promises - PROBLEM | 00:43 |
29 | -----Ignore this video------- | 27:31 |
30 | Handling Promise Rejections - SOLUTION | 03:21 |
31 | Testing with Async Side Effects - PROBLEM | 01:53 |
32 | -----Ignore this video------- | 27:31 |
33 | Reliably Wait for Async Operations - SOLUTION | 03:19 |
34 | Recap of Testing Asynchronous Code | 00:22 |
35 | Overview of Vitest | 00:34 |
36 | Migrate Tests to Vitest - PROBLEM | 00:24 |
37 | -----Ignore this video------- | 27:31 |
38 | Installing, Configuring, and Testing in Vitest - SOLUTION | 02:28 |
39 | Vitest Review | 00:19 |
40 | Testing Fundamentals Workshop Outro | 00:26 |