The shape of a case

Precondition, steps, data, expectation.

A case that can be run without its author contains a precondition, steps, data and an expectation. The precondition is the world we start in: the user is logged in, the cart is empty, the language is English. The steps are what to click and what to type, in order. The expectation is what we will see if the product behaves correctly.

Data is written explicitly. "Enter a name" is worse than "enter Ann". "A large amount" is worse than "100000". The person running the case should not have to guess your taste. If any value from a class will do, say so: "any non-empty name shorter than 50 characters", and give one concrete example.

The expectation can be checked. "Looks good" cannot be checked. "The record Ann appeared in the list, no error message is shown" can. If the expectation is the absence of something, write what must not appear and where to look. Otherwise the person running it does not know where to look.

A short case is better than a long twenty-step scenario. A long one fails in the middle, and it is unclear which check died. Twenty steps are almost always several cases glued together by the habit of telling a story.

Practice

  1. What is missing

    A case has the steps "open the form and save". Which part is most often missing?

    • The company name in the document header
    • The data and the expectation
    • The tester's signature on every step
    • Always the button colour in hexadecimal
  2. A weak expectation

    Which expectation is weak: "looks good" or "Ann is in the list"?

  3. What goes into a case

    Select the necessary parts.

    • Precondition: the user is logged in
    • Input: Ann
    • Expectation: "it should be convenient"
    • Twenty unrelated checks in one case