RadarTrek
Home/Courses/Testing for Builders
Intermediate8 lessons · 3 free

Testing for Builders

Most developers either write no tests and regress constantly, or write obsessively many tests that break with every refactor. The discipline is knowing which tests to write, at which layer, and how to make them resilient to change. This course covers the full testing pyramid with Vitest, React Testing Library, and Playwright — with a practical emphasis on what is worth testing and what is not.

Start free lessons (3 free)
$49one-time · full course

What you will learn

Why most developers skip tests — and why that strategy fails
Unit tests with Vitest: fast, modern, and TypeScript-native
Integration tests: test real database queries and API routes
End-to-end tests with Playwright: test in a real browser
Test-driven development: write the test before the code
Mocking: when to mock and when not to
Testing authentication, payments, and external APIs
CI testing: run tests on every push with GitHub Actions

Course outline

Full course — $49 one-time

04

Integration Tests and Databases

Test your API routes against a real database — catch the bugs unit tests cannot see

10 min
05

What Not to Test

The tests that waste your time — and why deleting bad tests improves your test suite

7 min
06

E2E Testing with Playwright

Automate a real browser to test your most critical user journeys — sign up, pay, use the product

10 min
07

Test-Driven Development in Practice

Write the test first — a practical TDD workflow that improves design and catches regressions from day one

9 min
08

CI Testing Pipelines

Run your entire test suite automatically on every pull request — so nothing broken ever reaches main

8 min

Get the full course

All 8 lessons — unit, integration, E2E, TDD, and CI testing. Lifetime access.

8 lessons✓ Vitest + Playwright✓ Certificate included✓ Lifetime access
$49one-time

Written by the RadarTrek editorial team · Reviewed June 2026

About this course

Testing is the practice of verifying that your code does what you expect — and that it continues to do so as the codebase changes. Learning testing as a builder means understanding which types of tests provide the most value for a given codebase, how to write tests that are maintainable rather than brittle, how to test asynchronous code and database interactions, and how to use tests as a design tool that produces better code architecture. This testing tutorial for developers covers unit testing, integration testing, and end-to-end testing with modern JavaScript tools.

Developers who write tests ship with more confidence, make changes faster, and have fewer production incidents. After this course you will be able to write effective unit and integration tests using Vitest, test API routes and database interactions with realistic test data, run end-to-end tests with Playwright, and design a test strategy that provides adequate coverage without slowing down your development workflow.

Frequently asked questions

What is the difference between unit, integration, and end-to-end tests?

Unit tests test a single function or module in isolation — fast, deterministic, with all dependencies mocked. Integration tests test multiple modules working together — your API route connecting to a real database. End-to-end tests simulate a real user in a browser — clicking buttons, filling forms, verifying outcomes. Most applications benefit from many unit tests, fewer integration tests, and a handful of E2E tests covering critical user flows.

Should I mock the database in tests?

Mock the database for unit tests where you are testing business logic, not data persistence. Use a real database for integration tests — this is where database-specific behaviour (constraints, transactions, triggers) matters. In-memory databases like SQLite are sometimes used as a compromise, but PostgreSQL-specific features will not behave identically. Running integration tests against a real Postgres instance (in a Docker container in CI) is the most reliable approach.

What is test-driven development (TDD)?

TDD is a practice where you write the test before you write the code: write a failing test that describes the desired behaviour, write the minimum code to make it pass, then refactor. The discipline of writing tests first forces you to think about the API and behaviour before implementation. Many developers find that TDD produces better-designed, more testable code, even if they do not follow the strict TDD cycle for every line.

How do I test asynchronous code?

Modern testing frameworks handle async code with async/await. Write your test function as async and await any promises: `const result = await fetchUser(123)`. For testing code that uses timers (setTimeout, setInterval), Vitest and Jest provide `vi.useFakeTimers()` to control time in tests. For testing code that polls or retries, fake timers let you advance time without actually waiting.

How much code coverage should I aim for?

Coverage percentage is a vanity metric without context — 80% coverage that tests critical paths thoroughly is more valuable than 95% coverage that tests trivial getters. Target: near 100% on business logic with complex conditions, solid coverage on API routes and database interactions, and E2E tests on critical user flows. Do not optimise for a coverage number; optimise for confidence that critical functionality works.

RadarTrek Intel — monthly score updates

We track 40+ tools so you don't have to. Score changes, new tools, and new guides — once a month, no spam.