I've been spending a good deal of time lately thinking about the cognitive process of testing: What makes a good test case? How do we "know" that the software is fit for use? And why is that an area of such little interest in many test communities?
One thing that can help are examples that we can draw rules of thumb from. The typical example is the triangle problem
, where we have certain rules for types of triangles, an input for sides, and try to figure out if the software is calculating the correct type of triangle.
The triangle problem is a great example -- as long as you did well in Geometry in high school. I've been in search of other examples that don't require telling a scalene from a isosceles.
That said, you can test anything that consists of rules and examples. So here goes ...
Picture It: Maryland, 1982. You've been hired as an auditor to check to see if Weiss's Grocery Store
in Frederick is enforcing the sale laws correctly. You turn on your Plymouth Horizon and leave Middletown, taking Route 40 east, over Braddock Heights
- in the distance you can just barely make out the famous clustered spires of Frederick
... and then you're turning into the Weiss's parking lot. Before entering the store, you grab your clip-board and review the rules:Weiss's five basic types of products:
A) Staples - Break, Milk, Cheese, Water, Flour, Sugar, Juice)
B) Non-Staple Food such as Soda Pop, Ice Cream, Frozen Food, Candy Bars, Everything else
C) Alcoholic Beverages like Wine and Beer
E) Other items like toys, magazines, pencils, paper cooking supplies, and so onThe following laws apply:
1) Maryland State Sales Tax of 5% applies to all items except staples
2) Only food items (staples and non-staples) can be sold on Sundays
3) All times must have a white tag that lists the price of the item; that price must be correctly charged by the cahsier
4) Listed prices in the weekly 'sale' circular must be displayed with a yellow that; that price must be correctly charged by the cashier
5) You must be twenty-one years of age to purchase alcoholic beverages; the cashier should card you if you appear to be under thirty-five
6) Alcoholic Beverages cannot be sold between 10PM and 6AM
7) You must be eighteen years of age to purchase cigarettes; the cashier should request identification if you appear to be under thirty
Your job is to ensure that the correct laws and taxes are applied, and items are sold for the correct amount. (If you really want to be testing software, imagine that the rules must be applied through self-service checkout stations.)
Challenge: How would you test this? Defend your answer.UPDATE:
Yes, I welcome clarifying questions, and NO, you don't need to test the website. I've linked to that solely as background information. The test is theoretical and set in 1982.