Writing a good test case means reading the requirement carefully, splitting the input data into equivalence partitions, picking a representative value and the boundary values, then writing each test case as one row with an ID, preconditions, steps, test data and a measurable expected result. Someone else must be able to run it exactly the same way and decide pass or fail without asking you. This lesson gives you a 9-column test case template you can use straight away in Excel, Google Sheets or Jira, explains how test cases differ from test scenarios, and works through one complete feature, "enter a quantity for the shopping cart", from requirement to 9 test cases.
By the end of this lesson, you will be able to:
- Tell test scenarios, test cases and checklists apart, and know when to use each.
- Fill in all 9 fields of a test case so that others can rerun it and the expected result can be verified.
- Apply equivalence partitioning to cut the number of test cases without missing any group of data.
- Choose the right boundary values (2-value or 3-value) for numeric fields and text length fields.
- Self-review a test suite with a checklist and build a traceability matrix from requirements to test cases.
Learning software testing properly? Writing test cases is step 2 of the roadmap, right after testing fundamentals and the software development process. See the 8-step software tester roadmap to learn in the right order, from test cases to Jira, Postman, automation and ISTQB.
What is a test case, and how is it different from a test scenario?
A test case is a set of preconditions, steps, input data and an expected result used to check one specific behaviour of the software. Each test case answers a closed question: with this data and these steps, does the system return exactly this result? A run ends in a small number of clear states such as Pass, Fail or Blocked.
Test scenario: what to check, not yet how
A test scenario is one sentence describing a user situation that needs checking, for example "Check adding a product to the cart with different quantities". One scenario usually produces several test cases. Scenarios keep you from missing features; test cases keep you from missing data and steps. In many small teams in Vietnam, the QA lead approves the list of scenarios first, and testers then write detailed test cases.
Checklist: fast, but depends on who runs it
A checklist is a list of short bullet points such as "Quantity box rejects letters". It is quick, but it lacks concrete data and expected results, so two people can reach two different conclusions. Beginners should practise writing full test cases first.
Quick comparison of the three documents
| Criterion | Test scenario | Test case | Checklist |
|---|---|---|---|
| Level of detail | One sentence, feature level | Full steps, data, expected result | One short line |
| Can others rerun it | No, they must work out how | Yes, with the same conclusion | Yes, but easy to read differently |
| Time to write | Fast | Slowest | Fast |
| Use for | Scoping, estimating | Important features, regression testing, handover | Quick checks, exploratory, smoke tests |
The 9-column test case template and how to fill each column
There is no single mandatory template for every company, but most test case templates in Excel, Google Sheets, TestRail, Zephyr or Xray revolve around the 9 fields below.
| Column | What to write | Example |
|---|---|---|
| 1. ID | Unique ID with a feature prefix | CART-QTY-01 |
| 2. Title | Behaviour under test, starting with a verb | Add to cart with quantity 1 (lower boundary) |
| 3. Preconditions | State required before running | Logged in; product A has 50 in stock |
| 4. Steps | Numbered actions, one action per step | 1. Open product A page. 2. Enter quantity. 3. Click "Add to cart" |
| 5. Test data | Exact input values | Quantity = 1 |
| 6. Expected result | Something observable and measurable | Message "Added to cart"; cart icon goes up by 1 |
| 7. Actual result | Filled in when running | Shows "Added to cart"; cart goes from 0 to 1 |
| 8. Status | Pass / Fail / Blocked / Not run | Pass |
| 9. Priority | High / Medium / Low | High |
Many teams add columns for "Requirement ID" (a link to the user story or specification), "Author", "Run date", "Environment" (browser, device, build) and "Bug ID" (a link to the Jira bug when it fails). "Requirement ID" is well worth adding, because it lets you build the traceability matrix later.
Writing the title and steps
The title states the behaviour and the distinctive data: "Show an error for quantity 11 (above the upper boundary)" is much better than "Test quantity 2". Write steps as commands, one action per step. Name the button or field label; do not describe "the green button at top right", because the test case breaks as soon as the design changes.
Writing measurable expected results
The expected result is where beginners go wrong most often. "The system works normally" or "Displays correctly" cannot be verified. Write what you can see or check: the exact message text taken from the requirement, values on screen, records in the database, the API status code. If the requirement does not state the message text, that is a question to send back to the BA (business analyst), not a gap for you to fill with a guess.
One test case checks one thing
Each test case should have one main check. If you put five values in one test case and it fails, you cannot tell which value caused the failure. The exception is an end-to-end test case such as search for a product, add to cart, check out.
The process: from requirement to test cases
Good test cases start with understanding the requirement, not with opening Excel. Requirement reading usually happens with developers and the BA in front of the sprint board (Figure 1), where you ask about anything unclear straight away.
Photo: Nghungdo / Wikimedia Commons, CC BY-SA 4.0
Steps
- Read the requirement and the acceptance criteria of the user story. Underline every number, limit, error message and user permission.
- Write down questions for anything vague: how negative numbers are handled, what about decimals, what message an empty box shows. Send them to the BA or product owner before writing.
- List the test scenarios: main success flow, error flows, permissions, layout on different devices.
- Apply design techniques: equivalence partitioning and boundary values for data fields; a decision table when several conditions combine.
- Write the test cases in the 9-column template, with IDs carrying a feature prefix.
- Set priorities: payment flows, login and customer data get High.
- Peer review with another tester or a developer, and fix what they find.
- Build a traceability matrix: every requirement has at least one test case, every test case points back to a requirement.
Read the requirement with a developer
Sitting next to a developer while they explain the processing flow (Figure 2) tells you whether data is validated in the browser or on the server, and which hidden limits the document does not mention. Record the answers in the user story itself so the whole team can see them.
Photo: Lisamarie Babik / Wikimedia Commons, CC BY 2.0
Do not forget environments and devices
A feature can work on a computer but fail on a phone (Figure 3), for example when a narrow screen hides the message. Record the environment in its own column and run High priority test cases on at least one desktop browser and one popular phone.
Photo: wocintechchat.com / Wikimedia Commons, CC BY 2.0
Equivalence partitioning
Equivalence partitioning means splitting the input data into groups in which the system is expected to behave the same way, so each group needs only one representative value. The technique is part of the ISTQB Foundation syllabus and is one of the skills most often asked about in junior tester interviews.
How to split partitions
- Valid partition: data the requirement allows, for example a quantity from 1 to 10.
- Invalid partitions: everything outside on each side, for example below 1 and above 10.
- Wrong type: letters, special characters, decimals when only whole numbers are allowed.
- Empty: left blank, or only spaces.
One invalid value per test case
When a form has several fields, each test case should give only one field an invalid value. If you enter a wrong quantity and a wrong discount code together, the system often reports the first field and stops, hiding the error in the second.
Examples beyond numeric fields
A password of 8–20 characters has three partitions: under 8, 8 to 20, over 20 characters. An email field has partitions such as: valid format, missing @, missing domain. The question is always: where does the system treat this group differently from that one?
Boundary value analysis
Boundary value analysis tests right at the edges between partitions, because developers often get comparison operators wrong, writing "<" instead of "<=" or the other way round. That kind of bug makes the value 10 get rejected even though the requirement allows it, or lets 11 slip through. A mid-range value like 5 almost never catches it.
2-value and 3-value boundaries
- 2-value: take the boundary and the nearest value outside it. For 1–10 that is 0, 1, 10, 11.
- 3-value: add the nearest value inside. For 1–10 that is 0, 1, 2, 9, 10, 11.
Beginners can use 2-value boundaries for most features; use 3-value for fields involving money and deadlines.
Boundaries of length, dates and money
A password of 8–20 characters has boundaries at 7, 8, 20 and 21 characters. A promotion valid "until 31/12" has boundaries at 23:59:59 on 31/12 and 00:00:00 on 01/01. Free delivery for orders from 300,000 VND (about 12 USD) has boundaries at 299,999 and 300,000 VND. Ask about hidden boundaries too: if only 3 items are left in stock, the real upper boundary becomes 3.
Combining the two techniques
A compact routine: list the partitions, take one representative for each partition without boundaries (wrong type, empty), then take the boundary points for the numeric partitions. Many teams also keep one mid-range valid value as the main-flow test case.
Worked example: test cases for the cart quantity box
The requirement on an online shop: "On the product page, the customer enters a whole-number quantity from 1 to 10 and clicks Add to cart. Above 10, show 'Maximum 10 items per order line'. Below 1, empty, or not a whole number, show 'Please enter a quantity from 1 to 10'. If the quantity exceeds stock, show 'Only N items left'."
Step 1: partitions and boundaries
- Valid partition 1–10: representative 5; boundaries 1 and 10.
- Invalid partition below 1: boundary 0.
- Invalid partition above 10: boundary 11.
- Wrong type: 2.5 (decimal) and "abc" (letters).
- Empty: left blank.
- Stock condition: only 3 left, customer enters 5.
Step 2: the test case table
Shared preconditions: logged in, cart empty, product A has 50 in stock (except CART-QTY-09, where stock is 3). Shared steps: open the product A page, enter the quantity, click "Add to cart".
| ID | Title | Data | Expected result | Priority |
|---|---|---|---|---|
| CART-QTY-01 | Add successfully with a mid-range value | 5 | Shows "Added to cart"; cart has 5 of product A | High |
| CART-QTY-02 | Add successfully at the lower boundary | 1 | Shows "Added to cart"; cart has 1 of product A | High |
| CART-QTY-03 | Add successfully at the upper boundary | 10 | Shows "Added to cart"; cart has 10 of product A | High |
| CART-QTY-04 | Error just below the lower boundary | 0 | Shows "Please enter a quantity from 1 to 10"; cart stays empty | High |
| CART-QTY-05 | Error just above the upper boundary | 11 | Shows "Maximum 10 items per order line"; cart stays empty | High |
| CART-QTY-06 | Error for a decimal | 2.5 | Shows "Please enter a quantity from 1 to 10"; cart stays empty | Medium |
| CART-QTY-07 | Error, or letters cannot be typed | abc | Box does not accept letters, or shows "Please enter a quantity from 1 to 10" | Medium |
| CART-QTY-08 | Error when left empty | (empty) | Shows "Please enter a quantity from 1 to 10"; cart stays empty | Medium |
| CART-QTY-09 | Error when exceeding stock | 5 (stock 3) | Shows "Only 3 items left"; cart stays empty | High |
Step 3: check the numbers
The suite has 9 test cases: 3 valid (01–03) plus 6 invalid (04–09), 3 + 6 = 9. High priority has 6 (01, 02, 03, 04, 05, 09) and Medium has 3 (06, 07, 08), 6 + 3 = 9. Trying every whole number from 0 to 100 would take 101 runs and still miss decimals, letters and the empty box; the two techniques cover every group with just 9.
Time estimate for a beginner: about 6 minutes to write each test case, 9 × 6 = 54 minutes; peer review 15 minutes; total 54 + 15 = 69 minutes, or about 1 hour 9 minutes. Running them by hand takes about 3 minutes each, 9 × 3 = 27 minutes for one round in one browser. CART-QTY-07 has two acceptable expected results because the requirement is unclear; that is exactly the question to send back to the BA so you can settle on one result.
A note on test data: never use real customer names, phone numbers, addresses, card numbers or passwords in test cases or test environments. Use clearly labelled fake data (for example emails like [email protected]) and the test cards that payment gateways provide for sandbox environments. Do not run tests that create orders, move money or send bulk messages on the live (production) environment without your lead's permission.
Common mistakes when writing test cases
Vague expected results
Sign: the result column says "Displays correctly" or "System works normally". Cause: the requirement was not read carefully, or it is incomplete. Fix: copy the exact message, value and state from the requirement; if it is missing, ask the BA and record the answer.
Steps only the author understands
Sign: someone else gets stuck because they do not know which account or product to use. Fix: state the test account, the data needed and the environment URL. Give the test case to someone who does not know the feature and let them run it (Figure 4).
Only the happy path
Sign: the suite contains only valid data. Cause: invalid partitions and boundaries were skipped. Fix: for every data field ask "smaller, larger, wrong type, empty, then what?". Most bugs users hit live in those error branches.
Duplicates and bloat
Sign: three test cases enter 3, 5 and 7 for the same valid partition. Fix: keep one representative per partition plus the boundary points, and delete the duplicates.
Photo: WOCinTech Chat from New York City, United States / Wikimedia Commons, CC BY 2.0
Reviewing and tracing test cases
Self-review checklist
- Unique ID, title starting with a verb and naming the distinctive data.
- Preconditions complete enough for a stranger to run it.
- One action per step, numbered.
- Expected result measurable and matching the wording of the requirement.
- Valid, invalid, wrong-type and empty partitions plus boundary points all covered.
- No real customer data.
Requirement traceability matrix
A traceability matrix puts requirement IDs in the left column and test case IDs on the right: the requirement "Cart quantity" points to CART-QTY-01 to 09. When the BA raises the limit from 10 to 20, a glance at the matrix tells you to update test cases 03 and 05. An outdated test case is worse than none, so update it in the same sprint the requirement changes.
Frequently asked questions
Which test case template is best for beginners?
The 9-column template in this lesson (ID, title, preconditions, steps, test data, expected result, actual result, status, priority) in Google Sheets or Excel is enough to practise. At work, companies may use TestRail, Zephyr or Xray on Jira, but the fields are similar.
Test case or test scenario: which comes first?
Usually you write test scenarios first to agree on scope, then split each scenario into several test cases. For a small feature you can do both in one session.
How many test cases does a feature need?
There is no fixed number; it depends on the number of data fields, partitions, boundaries and the level of risk. Equivalence partitioning and boundary values keep the suite complete without bloating it, as with the quantity box that needs only 9 test cases.
Practice exercises and self-assessment
- Write test cases for a "Password" field of 8–20 characters that must contain at least 1 digit, using the 9-column template.
- Write test cases for the rule "free delivery for orders from 300,000 VND" using 2-value boundaries.
- Build a traceability matrix for both requirements and ask a friend to run any 3 of your test cases.
Self-assessment criteria
- Pass: valid, invalid, wrong-type and empty partitions are all covered; boundaries are correct (7, 8, 20, 21 characters; 299,999 and 300,000 VND).
- Pass: your friend reruns 3 test cases without asking you anything and reaches the same conclusion.
- Pass: every expected result states something concrete, with no "correct" or "normal".
- Not yet: only the happy path, several invalid values in one test case, or missing preconditions.
Once you can write solid test cases, move on to the next step of the roadmap: Running tests and reporting bugs in Jira, where you execute this suite, record actual results and write bug reports with reproduction steps, severity and evidence.
Keep learning software testing: after test cases come bug reporting in Jira, API testing, automation and ISTQB. See the 8-step software tester roadmap.






