A Better Vocabulary for Software Testing


Calling a test a unit test tells us surprisingly little. What is the unit: a function, a class, a module, or a service? Is it isolated, or does it retain state between calls? Calling another test end to end tells us which boundaries it crosses, but not what it tries to prove or how it decides whether the result is right. Terms such as load, stress, penetration, and chaos testing describe other concerns, yet they are often mixed into the same list as if every name occupied one level of a single hierarchy.

Alperen Keles proposes a more useful vocabulary: describe the independent choices that make up a test. The central questions are what is under test, what claim are we checking, what will judge the result, how are inputs chosen, and what environment can affect the run? These choices can be combined. A property test can exercise a function or an entire stateful service; a performance test can use fixed examples or generated workloads. The terms become actionable when they tell us what to change when a test misses a bug.

Start with the boundary and the state

The first choice is scope. A test might call one function, exercise an object through its methods, cross a module boundary, or send requests to a complete system. This is more precise than treating “unit,” “integration,” and “end to end” as fixed sizes. A module can hide a database; a single entry function can invoke nearly the whole application. Name the boundary that the test actually uses.

The second choice is whether behavior depends on history. For a stateless function, an input value and its output may tell the whole story. For a stateful component, the same input can produce different results after different earlier operations. Consider a stack: pop() after push(7) is a different case from pop() on a fresh stack. A useful test input is therefore an operation sequence, not merely one value.

In theory, we can represent a stateful operation as a pure mapping from (old state, input) to (new state, output). In practice, constructing a realistic database, cache, or distributed cluster state directly may be harder than reaching it by running commands. A simulation that starts from a known state and applies public operations is often the better model. Check invariants between operations as well as at the end.

Scope also changes the available input space. A function signature may accept many values that production code never passes to it. A system API usually parses and rejects malformed requests before they reach internal functions. Contracts, richer types, and domain models make the real preconditions explicit; otherwise a generator may spend most of its time on impossible or irrelevant inputs. This does not mean malformed input is unimportant. It means the test should say whether it targets the public validation boundary or a lower-level function under its documented preconditions.

Five independent questions define a test: boundary, claim, oracle, input selection, and environment. A stateful service example selects one answer from each.
A test is a combination of choices, not a rung on one testing ladder.

State the claim before picking the tool

A test is useful when it can falsify a claim. “This endpoint works” is broad; “a successful transfer preserves the total balance” is checkable. The claim might concern functional correctness, latency, security, accessibility, or recovery after faults. These are purposes of testing, not competing scopes. The same service can be tested for several purposes through the same public API.

The claim determines what evidence is needed. A latency claim needs timing under a defined load and hardware environment. A security claim needs an attacker model and an observable failure condition. A recovery claim needs a fault and a deadline or other condition for regained service. Accessibility may require a task, an assistive technology context, and a human judgment about whether the task can be completed. Merely running many inputs does not strengthen an undefined claim.

Some claims are about a single outcome. Others are about relationships across runs or over time. A codec should round trip: decode(encode(x)) == x. Sorting should be idempotent: sort(sort(x)) == sort(x). Two implementations that claim the same behavior can be compared on identical inputs. A service might promise that a request is never acknowledged before it is durable, or that an accepted job eventually finishes. The first is a safety claim, which a finite bad execution can refute; the second is a liveness claim, which needs assumptions about time, fairness, and the environment. Lamport’s discussion of safety and liveness makes this distinction precise.

Choose an oracle: who or what says “wrong”?

An oracle judges whether observed behavior violates the claim. A person can be an oracle. Exploratory tinkering—trying inputs, watching the output, and noticing something odd—is a real testing method, even when it has not yet produced an automated assertion. Many durable regression tests begin as observations made this way. Human judgment remains important for visual quality, usability, and cases where an exact expected output is hard to write down.

A fixed example encodes an expected result: add(3, 5) == 8. Examples are easy to read and valuable for known edge cases. Snapshot or golden tests preserve a whole output for later comparison. Their danger is that the first captured output can contain a mistake; accepting a snapshot is a judgment about correctness, not proof supplied by the testing framework. The snapshot then becomes a regression oracle for subsequent runs.

Assertions inside the program provide another oracle. Preconditions describe valid inputs, postconditions describe required results, and invariants describe rules that should hold across relevant states. They can run under ordinary examples, generated inputs, or production traffic. An assertion does not choose inputs on its own; it tells a test what to observe when those inputs arrive.

Properties generalize beyond a handful of examples. Round trips, idempotence, conservation rules, and equivalence between implementations all create oracles without writing a separate expected output for every input. A metamorphic property relates two executions when neither output is easy to predict alone. For example, reordering an input set may leave a set-valued result unchanged. Differential testing compares an implementation with another implementation or a simpler reference model. Csmith uses generated C programs and compiler comparisons to find discrepancies; a discrepancy is a lead that still needs diagnosis because either side may be wrong.

A good oracle can be wrong or incomplete. decode(encode(x)) == x may pass when both functions share the same bug, so independent implementations, format fixtures, or additional properties provide stronger evidence. Likewise, a test that only asserts “does not crash” cannot detect a silently wrong answer. The oracle’s blind spots matter as much as the amount of generated data.

Choose the input method independently

With an oracle in hand, decide how to exercise it. Handpicked examples target known cases. Enumeration tries a defined set systematically and can be exhaustive for a small, finite domain. Property-based tools generate many values from a strategy and often shrink a failing case into a small counterexample. The Hypothesis stateful testing guide shows the next step: generate sequences of actions and compare the system with a simpler model.

Randomness can also mutate existing inputs rather than generate each one from scratch. Coverage-guided fuzzers favor mutations that reach new code paths; a sanitizer, assertion, or other oracle then catches bad behavior. OSS-Fuzz applies this pattern continuously to open-source projects. Coverage is feedback for exploring code, not a claim that the reached behavior is correct. A narrowly scoped fuzz target can report high coverage while missing a different entry point or semantic bug.

Static analysis is another input method in a broader sense: it checks possible programs or paths without executing each test case in the usual way. A type checker can reject a class of invalid programs; refinement types and model checkers can verify stronger predicates when the model and assumptions are adequate. These tools do not make runtime tests obsolete. They move some claims into a different checking process, usually with different limits and costs.

A test description should keep input selection separate from its oracle. “Property-based test” is common shorthand, but it can hide whether the property is a round trip, a model comparison, a state invariant, or only absence of crashes. “Fuzz test” says even less about the correctness condition. Say what is generated and what must remain true.

Put state and faults into the same experiment

For a stateful service, the input is often a stream of actions: create an account, deposit funds, transfer, retry, and query. A small reference model tracks expected balances while the real service runs those operations. At every step the test can check nonnegative balances, conservation, or agreement with the model. Hypothesis’s rule-based state machines express this with rules, preconditions, and invariants. SQLancer demonstrates a related idea for databases: generated statements and query transformations expose logic bugs without needing to know every answer in advance.

A generated action drives both the system under test and a simple reference model; an oracle compares their outputs and invariants, while a fault injector changes the environment before the next action.
Stateful testing needs an action sequence, a reference or invariant, and a controlled environment.

The environment is part of the input too. A browser’s network throttle, a disk error, a process restart, a delayed packet, or a partition can change the outcome even when the user command is identical. Chaos experiments introduce such faults into a running system. Deterministic simulation goes further by controlling sources of nondeterminism such as clocks, scheduling, and randomness, then replaying a failing seed. Antithesis’s explanation of deterministic simulation describes how fault injection and generated workloads can be combined with reproducible runs.

This yields a useful upgrade path. Start with a concrete failing sequence. Turn its essential rule into an invariant. Generate many legal action sequences. Add a simple reference model where possible. Then vary the environment—delay messages, restart a process, or fail storage—while preserving a way to reproduce failures. Each step changes one dimension of the test rather than merely renaming it from “integration” to “end to end.”

A compact way to describe a test

Imagine a retry test for a payment API. Instead of saying “we have an end-to-end test,” say: scope: public payment service; claim: one logical charge survives duplicate requests; oracle: ledger total and reference-model agreement; input method: generated sequences of submit, timeout, retry, and query; environment: injected response loss and controlled clock. That sentence reveals both coverage and missing pieces. If the test never restarts a worker, crash recovery remains untested. If it checks only HTTP status, duplicate charges can pass unseen.

The same vocabulary works at smaller scale. For a parser: function scope, valid-input round-trip claim, equality oracle, generated byte strings, ordinary local process. Add malformed bytes and a “never crash” oracle for a separate security-oriented test. Add a reference parser for differential checking. The combinations are deliberate and legible.

The point is not to abolish familiar names. “Unit test” and “end-to-end test” remain useful shorthand in a team’s conversation. But when a test plan needs to explain what evidence it provides—or why a bug escaped—scope alone cannot carry the answer. Name the claim, oracle, input method, and environment, then strengthen the weakest part.

Further reading

100%