Assertion
The statement in a test that must hold, and the only part that can actually fail.
An assertion is the check inside a test that decides pass or fail. Everything else in a test is setup; the assertion is the specification.
Several properties separate a useful assertion from a decorative one.
It must be reachable. An assertion after a step that can throw never runs on a broken path. An assertion placed outside the claim it supports cannot fail inside that claim — a structural trap in any system where claims are recorded per assertion.
It must be able to fail. See Falsifiability and Vacuous Truth. Checking that a class is present when the question is whether the class resolves to anything is the commonest form of a passing assertion that proves nothing.
It should assert the invariant, not the incidental. An assertion pinned to a value that legitimately varies — a token count, an exact sentence, a generated identifier — will break on every unrelated regeneration and be read as a failure.
Its failure message should identify the problem. A message naming the expected condition saves more time than any amount of test structure.
A related discipline: when a test is written after a fix, revert the fix and watch the assertion go red before trusting it. The counts confirm it — a suite going from two failing to zero is evidence; a suite that was already green is not.
See also6
Hand-picked in the note itself — the neighbours worth reading next.
Falsifiability
A claim is only worth something if you know what observation would refute it.
Method16 connections
Vacuous Truth
A statement that holds only because its subject set is empty — a green result that measured nothing.
Method25 connections
Test-Driven Development
Writing a failing test first, making it pass, then improving the code with the test as a net.
Testing & Verification9 connections
LLM-as-Judge
Using a language model to score another model's output against a rubric.
Agents & Language Models10 connections
Fail Fast
Crash at the point of misconfiguration rather than degrading quietly into a wrong state.
Method12 connections
Nondeterminism
The property that identical inputs may produce different outputs, and what it costs to test around.
Agents & Language Models17 connections
Related3
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from6
Notes elsewhere in the wiki that reach for this one.
- Fail FastMethod
Crash at the point of misconfiguration rather than degrading quietly into a wrong state.
- FalsifiabilityMethod
A claim is only worth something if you know what observation would refute it.
- LLM-as-JudgeAgents & Language Models
Using a language model to score another model's output against a rubric.
- NondeterminismAgents & Language Models
The property that identical inputs may produce different outputs, and what it costs to test around.
- Test-Driven DevelopmentTesting & Verification
Writing a failing test first, making it pass, then improving the code with the test as a net.
- Vacuous TruthMethod
A statement that holds only because its subject set is empty — a green result that measured nothing.