Testing Fundamentals

Intro

Hi! Welcome to the "Testing Fundamentals" workshop of EpicWeb.dev! My name is Artem and I have a single goal: to teach you how to test anything. And I'm not talking just about the practical aspect of automated testing but also about the way you see and approach testing software, which is often overlooked even by experienced developers. This is going to be an exciting journey, and I can't wait to share with you everything that I know about testing.
But every journey has to start somewhere. We will start from the beginning. From the fundamentals of testing. To understand those, we will build our own testing framework from scratch! (We will also be testing stuff, don't worry!) And while doing so, we will go through the series of exercises which are going to lay for you the foundation of what automated testing is and how to do it in practice.

Exercises

Principles

We will start from the principles of testing. You will learn about what an automated test actually is and the reason you should write them. We will talk about the intentions and expectations we have while building software, and also the role implementation details play in testing. And, of course, you will start from writing the most basic automated test possible.

Test structure

Then, we will continue with the test structure. You will learn what makes up a test and how to read and navigate literally any test suite. All of that through improving our testing framework to provide declarative assertions, test isolation, and the means to deal with side effects.

Testing asynchronous code

We will explore the specifics of testing asynchronous code, which is one of the most common thing you will test in the wild. Making HTTP requests, rendering UI on the page, or awaiting a specific state—all of those are asynchronous actions, and all of them have to be tested properly. You will extend the testing framework to support asynchronicity, introduce new assertions for testing Promise fulfillments and rejections, and explore the good (and the bad) ways to await things you don't control.

Moving to Vitest

Finally, we will flip the switch and move to a testing framework called Vitest. You will be amazed how the fundamentals you learned transfer effortlessly between tools.

Going through the workshop

Just like the other workshops at EpicWeb.dev, each and every exercise will introduce a problem to solve and you would have to actually go and solve it. You can use your favorite IDE and the environment you are used to. You will also be using the Workshop app to help you get around the exercises easier, find the instructions, and compare your solutions to mine.
Let's get started!