More and more people are asking me about testing resources so let's put everything I've written in one post. Bookmark, share, and, most importantly, please read these.
The True Purpose of Testing
epicweb.dev/the-true-purposeā¦
Developers often overlook the fundamentals and rush into writing tests without properly understanding what a test is and what is its function. No test is inherently useful just because it exists. Read this one to learn what makes it useful.
The Golden Rule of Assertions
epicweb.dev/the-golden-rule-ā¦
There's a lot of debate over what makes a good test. In this one, I'm defining a short and objective way to grade a test's quality no matter the language or the tested system. This is, without a tinge of exaggeration, a game-changer in how you approach your tests.
Anatomy of a Test
epicweb.dev/anatomy-of-a-tesā¦
Let's talk about the building blocks that make up any automated test. From JavaScript to Go and Rustāthese blocks power tests everywhere. Know your blocks.
Implicit Assertions
epicweb.dev/implicit-assertiā¦
Did you know there's a way to express expectations in tests without writing "expect"? Those are called implicit assertions and they are tremendously powerful because they help you express more by writing less.
Inverse Assertions
epicweb.dev/inverse-assertioā¦
Sometimes you need to assert that something did not happen. That can be tricky, especially if that something is asynchronous. The last thing you want are false positives. What you actually want is inverse assertions.
Making Use of Code Coverage
epicweb.dev/making-use-of-coā¦
Code coverage has been an ongoing debate in the engineering circles. Is 100% code coverage in tests good? Bad? When should you strive for it? Why do people say it's harmful? I'm answering all those questions in this one and giving you practical tips on when to use (and not to use) code coverage.
Good Code, Testable Code.
epicweb.dev/good-code-testabā¦
You've gathered by now that some code is easier to test than the other. But why? Let's take a look at the characteristic of code's testability, what defines it, what is its relationship with complexity, and how to make your code more testable.
What is a Test Boundary?
epicweb.dev/what-is-a-test-bā¦
Automated tests rarely involve your entire system (yes, even the end-to-end ones have exceptions). There's often a place where you draw the line. The boundary. Learn what it is and how to use test boundaries efficiently to focus on the exact behaviors you want to test.
Be S.M.A.R.T. About Flaky Tests
epicweb.dev/be-smart-about-fā¦
Flakiness is the scourge of reliability. If you've written a test before, you likely had experience with flakiness. But what is it at its core and what causes it? And how should you deal with flakiness?
Writing Tests That Fail
epicweb.dev/writing-tests-thā¦
You write tests for them to fail. We all enjoy a green CI, but the true value of tests is when they fail. What matters is when and how they fail.