Test-Driven Development
Writing a failing test first, making it pass, then improving the code with the test as a net.
Test-driven development is the practice of writing a failing test before the code that satisfies it, then writing the minimum implementation to pass, then refactoring with the test as protection. The cycle is usually named red, green, refactor.
The red step is the one that carries the value, and it is the one most often skipped. A test written after the implementation and added to a passing suite has never been observed to fail, so it might be asserting nothing at all — see Falsifiability. Writing it first makes the failure a precondition rather than a hope.
The secondary benefit is design pressure. Code that is hard to test from the outside is usually code with tangled dependencies or unclear boundaries, and the friction shows up before the design has calcified.
The main misuse is treating it as a mandate to test every function in isolation. Tests bound to internal structure make refactoring expensive — the suite breaks when the implementation changes even though behavior did not, which trains people to distrust it. Favoring tests at the seams that outlast implementations, and integration over unit tests on private helpers, keeps the suite an asset rather than a tax. See Integration Test.
See also8
Unit Test
A fast, isolated test of one unit of behavior with its collaborators replaced.
Testing & Verification25 connections
Assertion
The statement in a test that must hold, and the only part that can actually fail.
Testing & Verification19 connections
Regression
A previously working behavior that a change has broken.
Method23 connections
Vacuous Truth
A statement that holds only because its subject set is empty — a green result that measured nothing.
Method26 connections
Tree Shaking
Statically removing exports that nothing imports, shrinking the shipped bundle.
Web Platform12 connections
Code Coverage
The proportion of code executed by a test suite — a map of what is untested, not a measure of quality.
Testing & Verification16 connections
Root Cause Analysis
Escalating past the visible symptom until you find the layer that actually produced it.
Method49 connections
Refactoring
Changing the structure of code without changing what it does, in small verified steps, so that the next change becomes easy.
Method11 connections
Linked from8
- Acceptance TestingTesting & Verification
Checking that software does what its users and stakeholders actually need, the criteria agreed before building, and the gap between passing every test and building the right thing.
- AssertionTesting & Verification
The statement in a test that must hold, and the only part that can actually fail.
- Cargo CultMethod
Imitating the visible form of a practice while the mechanism that made it work is absent.
- Code CoverageTesting & Verification
The proportion of code executed by a test suite — a map of what is untested, not a measure of quality.
- Integration TestTesting & Verification
A test exercising several components together, through real interfaces rather than doubles.
- RefactoringMethod
Changing the structure of code without changing what it does, in small verified steps, so that the next change becomes easy.
- Tree ShakingWeb Platform
Statically removing exports that nothing imports, shrinking the shipped bundle.
- Unit TestTesting & Verification
A fast, isolated test of one unit of behavior with its collaborators replaced.