A test case is the description of a single check: what to do, with what data, and what should result. It holds preconditions, steps, input data and the expected result, and a run adds the actual result and a pass or fail mark. Example for room booking: sign in as a guest, pick a room for June 1–3 and press “Book”; expected, the booking appears in the list and the room can no longer be picked for those dates. A test case may be written by a person for a manual check or by a developer as an automated test.
Frequently asked questions
What is a test case?
The description of a single check: preconditions, steps, input data and the expected result.
How is a test case different from an automated test?
A test case describes a check in words, while an automated test is the same check written as a program that runs itself. A test case can also be run by hand.
How is a test case different from a scenario?
A test case is one exact check with an expected result. A scenario is a user story of several steps from which several test cases are derived.
How do you write a test case?
State the goal in one phrase, write the preconditions and steps, give the input data and describe the expected result precisely so anyone can tell pass from fail.