Good testing is planned, not random. A test plan sets out exactly which data to try and what should happen, using normal, abnormal, extreme and boundary data. And once the program is in use, the work is not over: it must be maintained for as long as people rely on it.
Normal data is typical data that should be accepted. Abnormal (erroneous) data should be rejected: out of range or the wrong type. Extreme data is the largest or smallest value that is still accepted. Boundary data tests each side of a limit: the last value accepted and the first value rejected. A test strategy sets out the overall approach to testing; a test plan lists each test with its data, its type and the expected result. After release a program needs maintenance: corrective (fix errors), adaptive (change it for new requirements or a new environment) and perfective (improve it, for example its speed or ease of use).
In the lab, the age check accepts 11 to 18. Try each kind of test data in turn and see which values the program accepts and which it rejects.
| Type | Meaning | Tickets, 1 to 10 (Fig. 1) |
|---|---|---|
| Normal | Typical, sensible data that should be accepted | 4, 7 |
| Abnormal | Data that should be rejected: outside the range, or the wrong type | −3, 25, 4.5, "two" |
| Extreme | The largest and smallest values that are still accepted | 1 and 10 |
| Boundary | Values either side of each limit: the last accepted and the first rejected | 0 and 1; 10 and 11 |
Always give the expected outcome with your test data, and give the actual value, not a description. "A number just outside the range" earns nothing; "11, rejected" does.
Testing has to be planned during design, before coding starts, so that it is thorough and can be repeated after every change.
| No. | Purpose | Test data | Type | Expected result | Actual result |
|---|---|---|---|---|---|
| 1 | Typical value accepted | 4 | Normal | Accepted | |
| 2 | Lowest valid value accepted | 1 | Extreme | Accepted | |
| 3 | Value just below the range rejected | 0 | Boundary | Rejected, error message | |
| 4 | Highest valid value accepted | 10 | Extreme | Accepted | |
| 5 | Value just above the range rejected | 11 | Boundary | Rejected, error message | |
| 6 | Non-integer rejected | 4.5 | Abnormal | Rejected, error message | |
| 7 | Wrong data type rejected | "two" | Abnormal | Rejected, error message |
The actual result column is empty in the plan: it is filled in when the test is carried out. Do not confuse the test plan (written in design) with the test results.
Four quick checks. Each correct answer earns XP and records this skill on your profile.
An input accepts whole numbers from 1 to 10. Which value is extreme data?
In the lab, the age check accepts 11 to 18. Which pair is boundary data for the lower limit?
Which column is filled in only when the test is carried out?
A program is changed because a new law changes how VAT is calculated. Which type of maintenance is this?
Programs are often used for years, while bugs surface, laws and hardware change, and users want more. Maintenance is the longest and often the most expensive stage of the life cycle.
| Type | Why it is needed | Example |
|---|---|---|
| Corrective | To fix errors (bugs) found after the program is in use | A report crashes when a class has no students |
| Adaptive | To change the program for new requirements or a changed environment | A new tax rate becomes law; a new operating system is installed |
| Perfective | To improve a program that already works, e.g. make it faster or easier to use | A search is rewritten to run in half the time |
A cinema's ticket function charges 12.50 per ticket. The cinema now gives 10% off orders of 5 or more tickets. The function is analysed and amended to add this functionality:
// before
FUNCTION TicketPrice(Tickets : INTEGER) RETURNS REAL
RETURN Tickets * 12.50
ENDFUNCTION
// after: 10% discount for 5 or more tickets
FUNCTION TicketPrice(Tickets : INTEGER) RETURNS REAL
DECLARE Price : REAL
Price ← Tickets * 12.50
IF Tickets >= 5 THEN
Price ← Price * 0.9
ENDIF
RETURN Price
ENDFUNCTION
Corrective maintenance fixes something that was wrong. If the program was correct but the world or the requirements changed, it is adaptive; if it worked but is being made better, it is perfective.
Unlocks once the four checks above are done. Worth more XP, written to AS Paper 1 and Paper 2 standard.
A field accepts a percentage from 0 to 100. Which set of test data is all abnormal?
What is included in a test plan?
Users report that a program works correctly but takes too long to load. The developers rewrite it to load faster. Which type of maintenance is this?
Why is a test strategy needed?
This skill is now recorded on your profile. Keep the chain going.