Software Testing Guide: Unit, Integration and E2E Tests
Good tests let you change code without fear; bad tests slow you down. This guide follows the testing series from why we test and the shapes of a test suite to unit, UI, API and end-to-end tests, then TDD and mutation testing.
Every example was run, including the flaky tests that were reproduced and fixed.
Who it is for: Developers who want a clear testing strategy, and candidates preparing for testing questions.
10 lessons · Published by Jainik · Last updated
1. The foundations
- 1. Testing From Zero · 12 minWhy We Test, and the Shapes of a Test Suite
What tests prove and do not prove, the pyramid, trophy and honeycomb as models, what to test, a first node:test run, and bad tests.
- 2. Testing From Zero · 13 minUnit Tests and Test Doubles
Arrange-act-assert, stubs, mocks, spies and fakes, fake timers, async errors, test isolation, and why mocking your own internals hurts.
2. UI, API and end-to-end tests
- 3. Testing From Zero · 13 minTesting UI Components with Testing Library
Queries by role, user-event, async UI, mocking the network with MSW, forms and error states.
- 4. Testing From Zero · 15 minIntegration and API Tests
Testing an Express API in-process, test database strategies, contracts, webhooks and queues.
- 5. Testing From Zero · 17 minEnd-to-End Tests with Playwright, and Fixing Flaky Tests
Playwright locators, auto-waiting, traces and isolation, with four flaky tests reproduced and fixed.
3. TDD and a team strategy
- 6. Testing From Zero · 19 minTDD, Property-Based Testing, Mutation Testing and a Team Strategy
A TDD kata, fast-check shrinking, Stryker mutation testing, coverage, and a one-page team test strategy.
- 7. Team Lead Mindset · 16 minTechnical Debt, Quality and the Rewrite Trap
Debt as a loan with interest, refactor or rewrite, a test plan, what to monitor, and lessons from five famous public outages.
4. Tools and interview questions
- 8. Full-Stack Questions · 28 minTesting Tools: Jest, Vitest, Testing Library, Playwright
Mocks and fake timers, MSW, user-event, testing hooks and Server Components, Playwright locators and flaky tests, database tests with Prisma.
- 9. Senior Frontend Depth · 15 minFrontend Testing Strategy: Unit, Integration, E2E and What to Skip
Test what users see, not how the code is built. Mock the network, not your modules. Keep end-to-end tests for the key flows only.
- 10. Backend in Depth · 15 minTesting an API: Unit, Integration and Contract
Where to spend your testing effort in a backend, testing against a real database, and contract tests between the frontend and the API.
More reading orders are on the guides page, and every series is listed on the home page.