4A Testing - Arrange Act Assert Annul

A small upgrade to Arrange–Act–Assert: add “Annul” as a reminder to clean up state and make tests independent.

4A Testing - Arrange Act Assert Annul

You may be familiar with Arrange–Act–Assert (common in the .NET world).

You may also know the Four-Phase Test pattern (popularized in a few communities, including Ruby).

Here’s my tiny tweak: 4A TestingArrange, Act, Assert, Annul.

The extra “A”: Annul

“Annul” is a reminder to undo any state your test created so other tests don’t become order-dependent.

That might mean:

  • Closing files / network connections
  • Deleting temp data
  • Resetting environment variables
  • Rolling back database changes
  • Clearing caches / queues

In many frameworks, this is your tearDown / afterEach / finally block. The label doesn’t matter—the habit does.