Use case testing

Use case testing is a black-box technique that derives test cases from use cases, the written descriptions of how an actor reaches a goal with the system. Each path through a use case becomes a test: the main flow where everything works, the alternative flows where the actor chooses differently, and the exception flows where something fails.

The longer version

A use case names an actor, a goal, any preconditions, the steps taken and what is true afterwards. The tester reads it as a map of routes. The main flow is one route, every point where the actor can choose differently opens an alternative, and every point where something can go wrong opens an exception. Each route becomes a test case with the expected result the use case describes at its end.

Take paying by card at checkout. The main flow runs from basket to confirmation. An alternative flow applies a discount code on the way, and exception flows cover a declined card, a session that times out on the payment page and a price that changed while the customer was paying. Five or six tests come out of one page of text, and each one traces to a sentence a stakeholder agreed to.

The technique tests whole interactions between steps and components, which suits system and acceptance testing. It says little about the values entered at each step, so it is combined with equivalence partitioning and boundary analysis on the individual fields. Where a team writes stories with acceptance criteria instead of use cases, the same approach of walking the main path, the variations and the failures still applies.

Common questions

What is use case testing?

Use case testing is a technique that creates test cases from use cases, so that the main flow, the alternative flows and the exception flows each get at least one test.

What is a use case in testing?

A use case is a description of how an actor, such as a customer or an administrator, interacts with the system to reach a goal, written as a main flow plus the variations and failures that can occur along it.

What are main, alternative and exception flows?

The main flow is the normal path where the actor reaches the goal. Alternative flows are valid variations on it, such as choosing another payment method, and exception flows describe what happens when something fails, such as a declined card.

Is use case testing black-box testing?

Use case testing is a black-box technique because the tests come from the described behaviour of the system and not from its code. The tester needs the use cases and the expected outcomes, and not the source.

How does use case testing relate to user acceptance testing?

Use cases often form part of what stakeholders sign off, so tests derived from them are a natural source for acceptance testing. The same flows can also be run earlier by the test team at system level.

Bug reports that arrive ready to triage.

Collect replay, console, network and browser context with the Free plan.

<script src="…/widget.js" data-key="pb_pub_…">