There are two schools of test case writing, and they argue past each other. One says every case should be a numbered script: click this, type that, expect the following. The other says a case should be a sentence or two stating what to verify, and trust the tester with the rest. Both have produced test repositories that nobody wanted to open. Let us weigh them and then take a side.

The case for the full script

A scripted case has an ID, a title, preconditions, numbered steps with data, and an expected result per step or at the end. Its strength is repeatability. A new joiner on day two, or a business user doing acceptance testing, can run it and get the same result as the person who wrote it. It also leaves an audit trail, which matters in regulated work such as banking, insurance and healthcare, where someone may ask later exactly what was checked.

The weaknesses are cost and decay. A suite of 800 scripted cases, each with ten steps, has 8,000 steps that name specific buttons and menu paths. When the screen changes, someone has to update them, and in practice nobody does. The scripts become partly wrong, and testers learn to ignore what they say. Scripts also train people to follow, not to look. A tester who is ticking off step 7 is not noticing the spelling error in the corner.

The case for the short check

The lighter style writes a charter or a one-line condition: “A customer with an expired card sees a clear message and can add a new card without losing the cart.” It is cheap to write and does not break when the layout changes. It invites thinking, because the tester decides which expired card, which cart, which browser.

Its weakness is the opposite. Two testers will run it differently, so results are not comparable, and a defect found by one is hard for another to reproduce. A vague line like “verify payment works” can be marked passed after trying a single happy path. Without a clear expected result, “pass” means “I did not see anything wrong”, which is not the same thing.

My side: split by what the case is for

I think the fight is badly framed. The useful question is who will run this and how exact must the outcome be. Here is the split I would defend.

  • Write full scripts for calculations, business rules, regulatory behaviours and anything an auditor or client signs off. Exactness is the point there.
  • Write short checks for exploratory areas, usability, and screens that change every sprint.
  • Automate what is repetitive and stable, and let the automation code be the script. Do not maintain a manual script and an automated one for the same thing.

A middle form works well for most functional cases: a clear title, preconditions, three to six steps written at the level of intent (“add a Gold-plan customer with a 3-year history”) rather than clicks (“click the plus icon at top right”), and a specific expected result. Intent-level steps survive redesigns. Specific results prevent the vague pass.

What makes any case runnable by a stranger

Whichever style you choose, a few properties separate usable cases from decoration.

Preconditions must be reachable. “User has an active loan” is not a precondition unless it says which test account has one, or how to create one. This is the commonest reason a case cannot be run by anyone but its author.

Data must be named, not implied. “Enter a valid PAN” invites guessing. Give the value from your test data set, or say which rule the value must meet. For tests of rules, say exactly which input shows which boundary, for instance “age 59 and age 60 at the policy start date”.

Expected results must be observable. “System handles the error gracefully” cannot fail. “A banner reading ‘Card expired’ appears, the cart still holds 2 items, and no order record is created” can. If you cannot say how the case could fail, it is not a test yet.

One case, one purpose. A case that logs in, creates an order, edits it, cancels it and checks the report will fail at step 2 and tell you nothing about steps 3 to 5. Split it. Then the failure pattern across cases points at the cause.

Independence helps too. If case 14 only works after case 13 has run, then skipping or failing 13 turns 14 into noise. State dependencies explicitly or remove them.

A quick check before you save

Hand the case to a colleague who has never seen the feature and watch, without helping, for ten minutes. Every question they ask marks a gap in the text. This costs less than it sounds, and it is the nearest thing to a unit test for a test case.

Also keep the repository small enough to maintain. Review it at the end of each release: retire cases for removed features, merge near-duplicates, and mark cases that have not been run for a year. A repository of 300 cases people trust beats 3,000 they do not.

So the verdict: scripts where exactness is owed to someone else, short checks where thinking is the product, and in both cases an expected result specific enough to fail. A test case that cannot fail, or cannot be run by anyone else, is only a note to yourself.

Figures and names in the examples are illustrative.

Leave a Reply

Trending