Skip to content

Arrange-Act-Assert Structure

Clear test structure separates setup (arrange), execution (act), and verification (assert) into distinct phases - this separation makes tests readable, reveals their purpose, and exposes when tests are doing too much.

Tension Addressed

Sensitivity vs. Stability

Recognizable As

Three-section test methods; Given-When-Then in BDD; setup blocks distinct from execution and verification; tests with single clear action being verified

Canonical Sources

Beck, "Test-Driven Development" (2002); Meszaros, "xUnit Test Patterns" (2007)

Transfers To

Scientific method (setup, experiment, measurement); debugging process (reproduce, isolate, verify); proof structure (given, show, therefore)

Also known as "Given-When-Then" in behavior-driven development. The structure forces clarity: what context is established, what action occurs, what outcome is verified. Tests that jumble these phases are harder to understand and maintain.