A test case template with a worked example

A good test case can be run by someone who didn't write it, and its result means the same thing every time. Here is a template that does that, with a filled-in example you can copy.

The fields that matter

Most templates have too many columns. These eight are enough for nearly every services project:

FieldWhat goes in it
IDA short, stable key, such as PAY-T12. Never reuse one.
TitleWhat is being checked, in plain words: "Card payment succeeds with a valid OTP".
StoryThe story or requirement it covers, such as PAY-112.
PreconditionsWhat must be true before step 1: test data, user role, feature flags.
StepsNumbered actions, one action per step.
Expected resultWhat should happen after each step, or at least after the last one.
PriorityCritical, high, medium or low. It decides what runs when time is short.
SuiteThe module or area, so you can build a run for one part of the app.

Leave the result out of the test case itself. A test case is the instructions; each run records its own result. Mixing the two is how one sheet turns into ten copies.

A filled-in example

ID: PAY-T12 Title: Card payment succeeds with a valid OTP Story: PAY-112, "Pay a bill with a debit card" Priority: Critical Suite: Payments › Cards

Preconditions

  • A test customer with a saved Visa debit card and a bill of ₹1,250 due.
  • The payment gateway is in sandbox mode.

Steps

#ActionExpected result
1Open the bill and choose Pay nowThe payment page shows ₹1,250 and the saved card
2Choose the saved card and enter CVV 123The OTP screen opens
3Enter the sandbox OTP 111000A success page shows a payment reference
4Open Payment historyThe bill shows as paid with today's date and the same reference

Writing rules that save time later

  • One behaviour per test case. "Payment succeeds" and "payment fails with a wrong OTP" are two cases.
  • Exact test data. Write the amount, card and OTP, not "valid details".
  • Observable expected results. "Shows a payment reference" can be checked. "Works correctly" can't.
  • No hidden steps. If step 2 needs a logged-in user, say so in the preconditions.
  • Link every case to a story. It's the only way to answer "what covers this requirement?" quickly.
  • Write from the acceptance criteria. Each criterion should have at least one test case.

Common mistakes

MistakeBetter
Steps like "Test the payment flow"One action per step, with its expected result
Recording pass or fail in the test caseRecord results in a test run, one per release
Copying the sheet each releaseKeep one set of cases and create a new run
Cases with no link to a storyAdd the story key when you write the case
Only happy pathsAdd the main failure for each critical story

Using the template in a tool

The same fields work in a spreadsheet or a test management tool. In NaatOps, each test case has a title, preconditions, numbered steps with expected results, a priority and a suite, and links to the stories it covers. Cases can be drafted from a story's acceptance criteria, and runs record results separately for each release. If your cases are in Excel today, NaatOps imports them as they are.

See how to move test cases out of Excel, see the Excel import, or start free.

Stories, tests and API checks in one place

Free for up to 10 users. Team and Delivery start with a free trial, no card needed.