Test-Driven Development (TDD) Overview
Part of the QA Testing Roadmap
In short
In TDD, developers write a failing test before writing the code. QA rarely does TDD daily, but knowing it helps you understand how good teams build quality in.
A development practice (primarily used by engineers) where a failing test is written before the code that makes it pass — QA benefits from understanding this practice even though it's mainly a developer discipline.

Think of it like this
Drawing the target first
At an archery range you set up the target, then shoot. You'd never shoot an arrow and then paint a target around wherever it landed. TDD sets the target (the test) before writing the code.
Watch it happen
The red, green, refactor loop
1/4Write a small test for behaviour that doesn't exist yet. Run it. It fails: red.
The big ideas
What you need to know
A developer practice
TDD is mainly done by developers at the unit level, in very short cycles.
Tests by design
Every piece of code has a test from the start, which makes later changes safer.
What QA gains
Strong unit tests mean QA spends less time on basic bugs and more on integration and real user flows.
See it in code
Walk through the code
1// 1. RED: write the test first. It fails, applyCoupon doesn't exist yet.2test("SAVE10 takes 10% off", () => {3 expect(applyCoupon(500, "SAVE10")).toBe(450);4});5 6// 2. GREEN: write just enough code to pass.7function applyCoupon(total: number, code: string): number {8 return code === "SAVE10" ? total * 0.9 : total;9}1/2The test describes the behaviour before the function is written.
A tiny TDD cycle in a Jest or Vitest test file. Next, a new test for an unknown code would drive the next change.
Save yourself the pain
Common mistakes
Oops
Thinking TDD means QA writes tests before developers code.
Do this instead
TDD is usually developers writing unit tests first. QA's early work is more like ATDD and BDD.
Oops
Believing TDD means no bugs reach QA.
Do this instead
Unit tests miss integration, UX and environment problems. QA still has plenty to test.
Your mission
Try one TDD loop
Quick check
What is the first step of a TDD cycle?
Go deeper
- 1Learn the TDD cycle: red (failing test), green (passing test), refactor.
- 2Understand why TDD is primarily a developer practice, though QA collaboration on test design helps.
- 3Consider how TDD's unit-level tests complement, rather than replace, QA's broader test coverage.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.