Testing
Test data is the data you choose to run a program with to check that it works. The four types are normal, boundary, invalid and erroneous.
Normal test data is typical, sensible data of the correct type. The program should accept it without causing an error. For a program that takes a whole number of fish in a tank and only accepts 3 to 10, normal data could be 6.
Boundary test data has the correct data type and sits on the very edge of being valid: it uses the two values right at the ends of the allowed range: the smallest and largest numbers the program should allow. For the fish tank, the boundary values are 3 and 10. Boundary data is valid, so it may also be described as normal data. Testing values just outside the valid edge is good practice: 2 and 11 are invalid data because they are the right type (whole numbers) but the wrong value (outside the accepted range). The program should reject them.
Invalid test data is of the correct data type but should be rejected by the program. It has the right type but the wrong value, such as 2 or 11 above. Erroneous test data is of the incorrect data type and should also be rejected. It has the wrong type, such as "six" (text) or 5.5 (a decimal) when the program expects a whole number.
| Type | Example for 3 to 10 fish | Why |
|---|---|---|
| Normal | 6 | Typical whole number inside the range |
| Boundary | 3 or 10 | Valid edge whole number |
| Invalid | 2 or 11 | Whole number, but outside the range |
| Erroneous | "six" or 5.5 | Wrong data type |
Suitable test data must match the data type and valid range described in the scenario. Give actual values, not descriptions: 6 is test data, but "a number between 3 and 10" is not.
OCR GCSE Computer Science · Testing