Notes
The problem
Give two testers the task: test the save ten coupon. The first adds a hundred dollars of products, types the code, sees ten percent off and marks it passed. The second tries forty nine ninety nine, exactly fifty dollars, the code in lower case and an empty cart. Same task, very different coverage, and next sprint nobody knows what was actually checked. Written test cases fix this. They make the testing repeatable, reviewable and countable.
- task: "test the SAVE10 coupon"
- tester A: types SAVE10 on a $100.00 cart, sees 10% off, marks it PASS
- tester B: tries $49.99, $50.00, save10, an empty cart ...
- same task, very different
- coverage, no record of either
The idea
There are three levels of detail. A test condition is one thing worth checking, like save ten at exactly fifty dollars. A test scenario is a user goal from start to finish, like buying something with a coupon. A test case is the full recipe: what must be true before you start, the steps, the data, and the result you expect. Conditions and scenarios help you find what to test. Test cases make sure it gets tested the same way every time.
- test condition one thing worth checking "SAVE10 at exactly $50.00"
- test scenario a user goal, end to end "buy with a coupon"
- test case preconditions, steps, data, one expected result
Anatomy
Here are the fields most teams use, in a spreadsheet or a tool like Jira with a test plugin. An id, so you can refer to the case. The requirement it checks. A title that says the condition in plain words. Preconditions, what must be true before step one. Numbered steps. The test data. The expected result. And a priority. When you run it, you add the actual result and a status: passed, failed or blocked.
- id TC-06
- requirement PRICE-3
- title SAVE10 works at exactly $50.00
- precondition logged in, empty cart
- steps numbered actions
- test data 4 x Notebook ($12.50)
- expected discount -$5.00, total $49.99
- priority high
Find conditions
Start from the rule, not from the screen. Price three says save ten takes ten percent off when the subtotal is fifty dollars or more. Ask how it could go wrong. At exactly fifty. Just below, at forty nine ninety nine. Comfortably above. In lower case, because price two says codes are not case sensitive. After the cart shrinks below fifty, because price eight covers that. And an amount where ten percent is not a whole number of cents, because of rounding.
- SAVE10: 10% off when the subtotal is $50.00 or more
- exactly $50.00 → accepted
- $49.99 → refused, message
- well above, e.g. $80.00
- lower case save10 (PRICE-2)
- cart shrinks below $50.00 after applying (PRICE-8)
- 10% of an odd amount rounds to the cent (PRICE-6)
A worked case
Here is a real case. Precondition: logged in as Alice with an empty cart. Step one, open the Clean Code Notebook, which costs twelve dollars fifty. Step two, set the quantity to four and add it, so the subtotal is exactly fifty dollars. Step three, open the cart and check the subtotal. Step four, apply save ten. Expected: coupon applied, a discount of five dollars, shipping of four ninety nine because forty five dollars is under the free shipping line, and a total of forty nine ninety nine.
- pre: logged in as alice, cart empty (reset first)
- 1. open Clean Code Notebook
- 2. set quantity 4, Add to cart
- 3. open Cart: subtotal $50.00
- 4. type SAVE10, click Apply
- expected: "Coupon applied" discount -$5.00 shipping $4.99 total $49.99
Expected results
The expected result is where most test cases fail review. Discount works is an opinion. Discount minus five dollars, total forty nine ninety nine, is a fact anyone can check in one look. Error is shown is weak too. Which error, and what must not change? Write the exact message, and say the total stays the same. If you cannot write an exact expected result, you do not understand the requirement yet. That is a question for the product owner, not a guess.
- weak "discount works"
- strong "discount -$5.00, total $49.99"
- weak "error is shown"
- strong "This coupon needs a subtotal of at least $50.00", total unchanged
- weak "page loads correctly"
- strong "8 products, 0 errors"
Kinds of cases
You need three kinds of cases. Positive cases show the feature works with valid input: a quantity of one and of ten. Negative cases show it refuses bad input properly: zero and eleven are refused with the right message. Edge cases sit where rules meet: you already have five in the cart and add six more, so the line would become eleven. Or only three are in stock and you ask for four. Beginners write mostly positive cases. Most bugs live in the other two.
- positive quantity 1 and 10 are accepted
- negative quantity 0 and 11 are refused: "Quantity must be between 1 and 10"
- edge 5 in cart, add 6 more → line would be 11, refused
- edge 3 left in stock, ask for 4 (CART-3)
Running cases
When you run the cases, write down what happened. Passed means the actual result matched. Failed means you ran it and the result was wrong, so you also write the actual result and raise a bug. Blocked means you could not run it at all, for example because login was broken. Blocked is not the same as failed, and managers care about both. In the first ShopRung lab you will run your cases twice, the second time with three bugs switched on.
- TC-06 PASS
- TC-07 PASS
- TC-02 FAIL qty 11 accepted, line shows 11
- TC-09 BLOCKED cannot reach cart: login error
- fail = ran, wrong result
- blocked = could not run it
- every fail → a bug report
Traceability
Because every case names its requirement, you can build a traceability matrix: requirements down the side, the cases that cover each one, and their status. It answers two questions every release asks. Which requirements are tested, and which are failing? An empty row is a gap. Here nothing covers order two, the rule that placing an order reduces stock. That gap is exactly where a stock bug would slip through, so you write a case for it.
req cases status
CART-2 TC-01..05 1 fail
PRICE-3 TC-06, TC-07 pass
PRICE-4 TC-10, TC-11 pass
PRICE-9 TC-12..14 pass
ORD-2 - NOT
COVERED
gaps show up as empty rows Prioritise
There is never time to run everything before a release, so give each case a priority. Ask what it costs if this breaks, and how likely it is to break. Money, login, checkout and data loss are high. A main flow with an easy workaround is medium. A cosmetic issue on a rare page is low. The handful of highest cases become your smoke set, which tells you in fifteen minutes whether the build is worth testing further.
- high money, login, checkout, data loss, anything legal
- medium main flows with a workaround
- low cosmetic, rare paths
- smoke set: 10 to 20 high cases
- that say "is it worth testing
- further?" in 15 minutes
Rules of thumb
A few habits make test cases useful for years. Check one condition per case, so a failure tells you exactly what broke. Write steps a new joiner could follow. Use exact data, not any product. Keep cases independent, so one can run without another running first, and reset the data before you start. Write them from the requirement before the build arrives, which often finds gaps early. And have a colleague review them, the way developers review code.
- one condition per case
- steps a new joiner can follow
- exact data, not "any product"
- one checkable expected result
- independent: no case needs another case to run first
- reset data before you start
- write cases before the build arrives, from the requirement
- review cases like code
Common mistakes
These are the mistakes reviewers and interviewers catch. An expected result like works fine. Ten different checks crammed into one case, so a failure means nothing specific. Steps like test the cart. Only happy paths. Writing down what the software does today as the expected result, which turns bugs into requirements. Cases with no requirement link. Cases that only work if run in a certain order. And cases nobody updates after the requirement changes.
- expected result "works fine"
- ten checks in one case
- steps that say "test the cart"
- only the happy path
- copying the developer's behaviour as the expectation
- no link to a requirement
- cases that depend on order
- never updating cases when the requirement changes
Say it like this
Interviewers often ask how you write test cases for a feature. A strong answer: I start from the requirement and list test conditions, valid, invalid and edge cases, using techniques like equivalence partitioning and boundary values. Each case has preconditions, exact test data, numbered steps and one exact expected result, and it links back to its requirement. Then I prioritise by risk, put the most important ones in a smoke set, and have the cases reviewed.
- "I start from the requirement
- and list test conditions: valid, invalid and edge cases, using partitions and boundaries. Each case has
- preconditions, exact data, numbered steps and one exact
- expected result, linked to its requirement. Then I prioritise
- by risk and review them."