Phase 1: Prepare
Step 1 Warm-up recall
From M8.L2: why keep a working copy?
Private: nothing you type here is sent or stored.
Step 2 Learning goal
By the end of this lesson you can:
- write a test plan with four kinds of case (Foundation);
- check counts and outputs (Core);
- trial the program on small data first (Core).
Phase 2: Teach
Step 3 A familiar example
A new bridge is tested with a light load before it opens, then a heavier one, and only then to traffic. A program is trusted in the same careful steps.
Step 4 Clear explanation
A test plan lists the cases before you run them, with the answer for each worked out by hand.
| Kind of test | Example for a stock report | What it shows |
|---|---|---|
| Normal | three valid rows | the main path works |
| Edge | quantity 0; exactly the reorder level | boundaries are right |
| Bad input | a blank line; text for a quantity; a missing file | failures are reported, not hidden |
| Count check | rows read = rows used + rows skipped | nothing goes missing |
Run the whole program on a tiny file you can check by eye. Compare each output line with your hand-worked answer. Check the counts: rows read, rows used, rows skipped.
Only when the small file is right, try a copy of real data, never the original. Then use the program in a limited way first, so a fault reaches few people. Real systems have failed when they were switched on for everyone at once after testing only part of the setup, or when test settings were left in place after the test.
Finally, write down what the tests did not cover. Honest limits are part of the test result.
Step 5 Worked example (4 marks)
A stock file has 10 lines; the program reports 7 to reorder, 2 fine and 0 bad. What does the count check say?
- Rows read are 10. (1 mark)
- Rows used plus skipped are 7 + 2 + 0 = 9. (1 mark)
- One row is unaccounted for. (1 mark)
- Answer: a row has gone missing; investigate before trusting the report. (1 mark)
Go deeper: the professor's notes
Typical.
Boundary.
Failures.
Coverage
| Tested | Risk |
|---|---|
| one data centre of two | unseen fault in the other |
| both | fault found early |
At work: A release
You are about to go live.
- Check for test settings.
- Start with a limited group.
What a careful practitioner decides. Widen use only when the last stage is safe.
Phase 3: Practise
Step 6 Learner practice (instant-marked)
1. A test plan should be written:
Know the answers first.
2. Real data should first be tried as:
Protect the original.
3. Bad input tests include:
Failures must be reported.
4. A limited trial helps because:
Contain the risk.
Phase 4: Close
Step 7 Recap
- Plan the tests: normal, edge, bad input, count check.
- Work answers out by hand; try a tiny file, then a copy of real data.
- Trial in a limited way and write down what was not tested.
Step 8 Exit ticket (ungraded)
List four test cases for a program that totals a column of quantities from a file.
Private: nothing you type here is sent or stored.
Step 9 Go further (Extension)
Write the full test plan for your capstone, with expected results.
In industry: HealthCare.gov: not tested for the load
The US Government Accountability Office found that the HealthCare.gov system and its supporting systems were not fully tested before the 1 October 2013 launch, and that capacity had not been planned adequately. A later official said testing had not included performance tests at the volume seen at launch.
Link to this lesson. Test at the load you will really face, and plan capacity from the start.
Source: GAO-15-238 (March 2015); Reuters, 2013
Common mistakes
| Mistake | Why it fails |
|---|---|
| Testing only normal data | Add edges and bad input. |
| Testing on the only original | Use a copy. |
| Leaving test settings in the real program | Check for leftovers before release. |
Limits. No plan covers every case; list what is not covered and review it after use.