Format for Test Cases: Fields, Templates and Worked Examples
The fields, layouts and worked examples that make a test case give the same verdict no matter who runs it or which phone it runs on.
In this article
- What a format for test cases has to do
- The nine fields every test case needs
- A format for test cases you can copy
- Three layouts, and when each one fits
- Format for test cases: three worked examples
- Example 1: OTP resend, as action and result pairs
- Example 2: a coupon rule, as Given, When, Then
- Example 3: boundary values, with the data kept outside the steps
- What a phone adds to the format
- IDs and traceability, the way Google lays them out
- Eight format faults that produce the wrong verdict
- Spreadsheet, tool or repository
- When an AI tool writes the cases
- A checklist before a case joins the suite
- Frequently asked questions
A QA lead in Indore inherits a regression sheet a week before release: 214 rows. Row 61 reads "Verify payment works properly." A tester picks up a Vivo Y28 on Airtel 4G, adds ₹200 to the wallet with UPI, sees a green tick and marks the row Pass.
That afternoon a second tester in Kochi runs row 61 on a Galaxy A15 on Jio. Her payment goes through as well, but the wallet balance takes four minutes to change. Is that a failure? The row does not say. She marks it Fail.
The sheet now holds a Pass and a Fail for the same row, and nothing in it says which is right. Neither tester was careless. The row had no starting state, no amount, no time limit and no result to compare against, so each of them filled the gaps in their own way. Deciding which gaps the writer must fill is the job of a format for test cases.
What a format for test cases has to do
A test case is a small experiment. It starts from a known state, does specific things with specific values, and compares what happens with what should happen. The format is the set of labelled blanks that holds those parts, and it has three jobs.
Make the case runnable by a stranger. The person who runs a case is rarely the person who wrote it. Six months on it may be a new hire or a tester in another city.
Make the verdict the same for everyone. Ubuntu's QA team set the bar in its test case guidelines, a wiki page last edited in 2014 that has aged well: a case has to be clear enough that two testers who run it against the same behaviour report the same result, and if any one condition fails, the whole case fails.
Make the case easy to find, trace and retire. An ID and a link to a requirement say why the case exists and when it can be deleted.
Written test cases often miss that bar. A 2023 study built a catalogue of eight recurring faults in manual tests written in plain language, and a survey of 24 test engineers showed 80.7% agreement with its definitions and examples. The researchers then ran a detection tool over 2,007 manual tests from three systems: the Ubuntu operating system, Brazil's electronic voting machine and the user interface of a large smartphone maker. It flagged 13,169 occurrences, an average of more than six per test (Soares et al., 2023).
Most of the eight are format faults: a blank that was missing, or content written into the wrong blank.
The nine fields every test case needs
| Field | Question it answers | Example |
|---|---|---|
| ID | How do I refer to this case? | PAY-014 |
| Title | Which behaviour does it check? | Wallet balance updates after UPI top-up on mobile data |
| Priority | What does skipping it risk? | P1 |
| Traces to | Why does the case exist? | Story WAL-212 |
| Preconditions | What is true before step 1? | Logged in, wallet balance ₹500, UPI app linked to the test account |
| Test data | Which exact values go in? | Amount: 200 |
| Steps | What do I do, and in what order? | Six numbered actions |
| Expected result | What should I see, and how soon? | Wallet shows ₹700 within 10 seconds |
| Environment | Where does it have to run? | Real phone, Android 13 or later, mobile data |
Those nine describe the case. Four more record each run: the build, who ran it and when, the status (Pass, Fail or Blocked), and the actual result with a bug ID when it fails.
Keep the two groups apart. The description changes only when the feature changes, while the run record grows with every release. The international standard for test documentation, ISO/IEC/IEEE 29119-3, sets out templates meant for any organisation, project or testing activity, and it draws the same line. Its contents list gives separate entries to the test case specification, the test procedure specification, the test data requirements, the test environment requirements and the actual results.
Three of the fields need one more line each.
The title states a behaviour and a condition, so that a failed case reads like a headline: "Wallet balance updates after UPI top-up on mobile data: Fail."
The priority follows a rule the whole team can recite. One that works: P1 for anything that blocks money, login or data, P2 for failures a user can recover from, P3 for polish.
The expected result is something visible, with a number or a piece of text in it. "Works correctly" is not a result.
Practical rule: if two testers could read the expected result and disagree about pass or fail, the case is not finished.
A format for test cases you can copy
The plain-text version below pastes into a spreadsheet, a test management tool or a Markdown file. Fill in every line, and write "none" where one does not apply, so the reader knows you checked.
ID: [AREA-NNN]
Title: [behaviour] [under which condition]
Priority: [P1, P2 or P3]
Traces to: [requirement, user story or bug ID]
Preconditions: [what is true before step 1]
Test data: [exact values, or the name of a data set]
Environment: [real phone or emulator, OS range, network]
Steps:
1. [One action, with the exact value]
2. [One action]
3. [One action]
Expected: [what the user sees, and how soon]
Run record, one line per run:
Build | Device and OS | Network | Run by | Date | Status | Actual result | Bug ID
Here is row 61 from the opening, rewritten.
PAY-014 · Wallet balance updates after UPI top-up on mobile data (P1)
- Traces to: Story WAL-212
- Preconditions: Logged in. Wallet balance ₹500. A UPI app is installed and linked to the test bank account. Wi-Fi is off.
- Test data: Amount 200
- Environment: Real phone, Android 13 or later, mobile data on Jio, Airtel or Vi
Steps:
- Tap "Wallet" on the home screen.
- Tap "Add money".
- Enter 200.
- Tap "Pay with UPI".
- Approve the payment in the UPI app with the UPI PIN.
- Tap "Done" to return to the app.
Expected: Within 10 seconds of returning, the wallet shows ₹700. The history lists one new entry, "Added ₹200", with today's date.
Run it on the Vivo and the Galaxy now, and the two testers cannot disagree. A balance that takes four minutes to change is a Fail, and the case ID goes into the bug report so the failure can be traced back to the check that caught it.
Three layouts, and when each one fits
The fields stay the same in every layout. What changes is how the steps and the expected results sit together.
Steps, then one expected result. This is the layout used for PAY-014. It suits short cases with a single outcome that matters.
Action and expected result in pairs. Each step gets its own check. This is the default format on Ubuntu's testing wiki: a numbered action, the result to expect beneath it, and a pass only when every action produces its listed result. Use it when the states in the middle matter, as they do in OTP, KYC and payment flows.
Given, When, Then. The Gherkin layout splits a case into a starting context, an action and an outcome. Cucumber's Gherkin reference describes Given as putting the system into a known state, When as an event or an action, and Then as an outcome that can be observed from outside. It recommends three to five steps per example, and it offers a Scenario Outline with an Examples table for running one case over many rows of data.
| Layout | Fits best | Watch out for |
|---|---|---|
| Steps, then one expected result | Short cases, smoke checks, one outcome | A wrong state in the middle goes unnoticed |
| Action and result in pairs | Long flows where every screen matters | Wide tables, and a right-hand column nobody reads |
| Given, When, Then | Business rules, data-driven cases, cases due for automation | Steps too abstract for a manual tester to follow |
A team can use all three, as long as the block of fields above the steps stays the same.
Format for test cases: three worked examples
Example 1: OTP resend, as action and result pairs
LOGIN-007 · Resend OTP stays locked until the countdown ends (P1)
- Traces to: Story AUTH-31
- Preconditions: Logged out. The SIM for 98XXXXXX10 is in the phone.
- Environment: Real phone, because the case needs a live SMS. Jio, Airtel or Vi.
| Step | Action | Expected result |
|---|---|---|
| 1 | Enter 98XXXXXX10 on the login screen | "Get OTP" becomes active |
| 2 | Tap "Get OTP" | OTP screen opens with six empty boxes and a countdown from 00:30 |
| 3 | Tap "Resend OTP" while the countdown shows 00:15 | Nothing is sent. The link stays grey |
| 4 | Wait until the countdown shows 00:00 | "Resend OTP" becomes active |
| 5 | Tap "Resend OTP" | A second SMS arrives and the countdown restarts at 00:30 |
| 6 | Enter the OTP from the first SMS | Error: "This OTP has expired" |
| 7 | Enter the OTP from the second SMS | Home screen opens |
Seven actions, seven checks. Written as steps with a single expected result ("user logs in"), this case would pass even if the resend link never locked. Step 6 is a negative check inside a positive flow, a pairing explained in positive and negative testing. More cases to adapt are in the free OTP login test cases.
Example 2: a coupon rule, as Given, When, Then
Scenario Outline: SAVE10 stays applied when the quantity changes
Given a cart with one "Cotton Kurta, size M" priced at ₹1,200
And the coupon SAVE10 is applied
When the shopper changes the quantity to <quantity>
Then the cart total shows <total>
And the coupon chip reads "SAVE10 applied"
Examples:
| quantity | total |
| 2 | ₹2,160 |
| 3 | ₹3,240 |
| 5 | ₹5,400 |
Five steps, three rows, one rule: 10% off whatever the cart holds. A fourth row costs one line, where a step table would need a whole new case. The expired-coupon path gets its own scenario, because its Then is different.
Cases like this often begin as a bug. Once the fault is fixed, its steps to reproduce become the regression case.
Example 3: boundary values, with the data kept outside the steps
PAY-021 · Add money accepts ₹10 to ₹5,000 and rejects amounts outside that range (P2)
- Traces to: Requirement WAL-R7, this app's own top-up limits
- Preconditions: Logged in.
- Test data: Data set "top-up limits": 9, 10, 5000, 5001
- Environment: An emulator is fine
Steps:
- Tap "Add money" on the Wallet screen.
- Enter the next amount from the data set.
Expected: Entering 9 shows "Minimum top-up is ₹10" and "Pay with UPI" stays disabled. Entering 10 or 5000 enables it. Entering 5001 shows "Maximum top-up is ₹5,000" and it stays disabled.
The four values sit on either side of each limit. Because they live in a named data set, a change in the limit means editing one line, not four cases.
What a phone adds to the format
On a laptop browser the Environment field can be one line. On a phone it decides the result, so give it structure.
| Field | Why it changes the result | How to write it |
|---|---|---|
| Device class | Memory and chipset differ | Budget Android with 4 GB RAM, or a named model |
| OS and skin | Background limits and permission dialogs vary by manufacturer | Android 14 on HyperOS |
| Network | Timeouts and retries depend on it | Jio 4G with weak signal |
| App state | Fresh installs and upgrades hold different data | Upgraded from the previous release |
| Permissions | A denied permission changes the flow | SMS denied, notifications allowed |
| Language and font | Long strings and large text break layouts | Hindi, largest font size |
| Real phone needed | Some behaviour cannot be trusted on an emulator | Yes: live SMS and handoff to the UPI app |
The last row saves the most time. Tag each case "real phone" or "emulator is fine" when you write it, and the run can be split between the two on day one. Google's core app quality guidelines suggest emulators for covering Android versions and screen resolutions, and also say a test environment should include a small number of actual hardware devices. Which failures show only on hardware is covered in emulator vs real device testing.
IDs and traceability, the way Google lays them out
The same Google page is a tidy model of tests tied to requirements. Each quality criterion sits in a table with three columns: an ID, the tests that verify it, and a description. The tests sit in their own tables further down, and each test ID is the criterion's name with "T-" in front. The criterion Sleep_Resume is verified by T-Sleep_Resume, and the test row links back to the criterion. The mapping is not always one to one: the criterion on storing sensitive data points to two tests, and three Google Play criteria share one.
Three habits carry over to any suite.
- Give every case a stable ID. An area prefix and a number, such as PAY-014. Never reuse an ID, and never renumber after a deletion.
- Put the meaning in the title, not the ID. PAY-UPI-NEG-4G-03 is out of date the day someone edits the case.
- Record what each case traces to. A case that traces to nothing is a candidate for deletion. A requirement with no case is a gap, which is the idea behind test coverage.
Eight format faults that produce the wrong verdict
The catalogue from the 2023 study names eight faults. The examples below are ours, and each fault has a fix in the format.
| Fault | What it looks like | Fix |
|---|---|---|
| Ambiguous step | "Enter a valid amount" | Write the value: "Enter 200" |
| Conditional step | "If KYC is complete, tap Withdraw" | Two cases with different preconditions |
| Several actions in one step | "Add the item, apply the coupon and pay" | One action per step |
| Action written as a check | Expected: "Tap OK and go back" | Move it into the steps |
| Precondition written as a step | Step 1: "Make sure the wallet has ₹500" | Move it to Preconditions |
| Check written as a step | Step 5: "Check the balance" | Move it to Expected, with the value |
| Unexplained term | "Complete VKYC via the BC flow" | Spell it out, or link a glossary |
| Action with no check | "Tap Pay", then straight to the next step | Add the expected result |
The conditional step does its damage quietly. A tester whose account takes the other branch never performs the check, and the case still shows Pass.
Practical rule: an action whose result matters gets its own check, and every check names a value.
Spreadsheet, tool or repository
| Home | Works when | Starts to hurt when |
|---|---|---|
| Spreadsheet | One team, a few hundred cases | Two people edit at once, or you need run history per build |
| Test management tool | Several testers, many runs, reports by priority | Every project adds its own fields |
| Files beside the code | Cases are reviewed in pull requests and automated later | People outside engineering have to run or edit them |
Wherever the cases live, keep the test data in one place, a separate tab or file, and refer to it by name. A changed test password should mean one edit, not two hundred. Give the format an owner too, so new columns are added on purpose. The habits that keep a library healthy once the format is settled are in best practices for test case creation and maintenance.
When an AI tool writes the cases
An assistant will fill any template you hand it, neatly, in seconds. The format will be perfect, and that is the risk: a complete-looking case reads as a checked one.
Look for four things. Expected results that restate the step ("payment is successful"). Buttons and screens the app does not have. Placeholder data ("a valid amount"). An Environment field left empty, or filled with "all devices".
Then add one field for generated cases: Verified on, the device and build on which a person last ran the case exactly as written. Until it is filled, the case is a draft. The review itself is covered in how to test AI-generated test cases.
A checklist before a case joins the suite
- The ID is unique and has never been used before.
- The title names a behaviour and a condition.
- The priority follows the team's written rule.
- The case traces to a requirement, a story or a bug.
- The preconditions describe a state anyone can reach.
- Every value is written out or named in the data sheet.
- Each step is one action, in the words the screen uses.
- Each expected result is visible and contains a number or a piece of text.
- The Environment field says whether a real phone is needed, and why.
- Someone other than the author has run it once and reached a verdict without asking a question.
The last item is the real test of a format. Our guide on how to execute test cases manually describes that first run.
Frequently asked questions
Is there a standard format for test cases? There is a standard with templates, ISO/IEC/IEEE 29119-3, but no single layout that every team must use. Most teams converge on the same core: an ID, a title, preconditions, test data, steps and an expected result.
How many steps should a test case have? For Given, When, Then cases, Cucumber's reference recommends three to five. Step tables have no fixed number, but past ten it is worth asking whether the first few steps are really a precondition, or whether the case checks two behaviours and should be split.
What is the difference between a test case and a test scenario? A scenario is one line that says what to test, such as "wallet top-up with UPI". A test case says how: the state, the values, the steps and the result. One scenario usually produces several cases. Our guide to the software testing scenario explains how to write one.
Are steps to reproduce a bug a test case? Not yet. Ubuntu's QA guidelines list them among the things that are not a test case. They describe a failure that has already happened, while a test case describes a check to repeat. Once the bug is fixed, the steps make a good regression case.
Should test cases be written in Excel? A spreadsheet is enough for one team and a few hundred cases. Move to a tool when you need run history per build, several people editing at once, or reports by priority.
A format is proven when someone who did not write the case runs it on a different phone and reaches the same verdict. 99tests runs your test cases on tester-owned Redmi, Realme, Galaxy, Vivo and iPhone handsets on Jio, Airtel and Vi, and a reviewer verifies every finding before it reaches you, with steps, expected and actual results, environment details and a screenshot or recording. Start from the free test case library, which has 950 cases across 25 flows, or read a sample report.