Computer ScienceExam code: 0984

Problem Solving and Design

Algorithm Design and Problem Solving

Test data is a carefully chosen set of inputs used to check that a program works correctly.

Different kinds of test data probe different parts of the program's behaviour. The syllabus names four categories.

Normal data

Normal data is data that the program should accept because it is within the expected, valid range.

For a program that accepts ages from 12 to 18:

  • Normal data: 14, 16, 17. All valid, should be accepted.

Normal data shows that the program does what it is supposed to do for typical input.

Extreme data

Extreme data is the largest and smallest values that should still be accepted.

For ages 12 to 18, the extremes are 12 and 18: the valid endpoints. Both should be accepted, because they are the smallest and largest values inside the allowed range.

Boundary data

tests the values either side of a limit: at each end of the range, the largest accepted value together with the smallest rejected value (the value just past the limit).

Boundary data checks both sides of each threshold, so for ages 12 to 18 the boundary tests are:

  • 11 (just below the lower limit): should be rejected.
  • 12 (the lower limit, smallest accepted): should be accepted.
  • 18 (the upper limit, largest accepted): should be accepted.
  • 19 (just above the upper limit): should be rejected.

Boundary data is where bugs often hide: many off-by-one errors only show up at the very edge of the valid range. Extreme data uses only the accepted endpoints (12 and 18); boundary data pairs each accepted endpoint with the rejected value immediately beyond it (so it also tests 11 and 19).

Abnormal / erroneous data

Abnormal data (also called erroneous or invalid data) is data that the program should reject because it is the wrong type, format, or simply outside the valid range.

For an age field, abnormal data might include:

  • "F" (a letter, wrong type).
  • -5 (negative, impossible).
  • 200 (far outside the valid range).
  • "" (empty input).
  • "@" (a symbol).

A well-written program does not crash on abnormal input; it shows an error message and asks the user to try again.

Common exam question

Choosing test data and stating the expected outcome

Question: Identify types of test data for a stated range or limit, with an example value and its expected outcome, or give two items of test data with a reason for each (4–9 marks).

Asked in 4 of the 17 papers. Type, example value and outcome or reason are each a separate mark. For ages 12 to 18: normal is a value inside the range, 15, accepted; extreme is an end value, 12 or 18, accepted; abnormal is outside, 25, rejected; boundary is a pair, 18 and 19, the first accepted and the second rejected.

To test a single whole-number limit such as "no more than 50", give 50, the largest that should be accepted, and 51, the smallest that should be rejected; the scheme accepts boundary or extreme for 50 and boundary, abnormal or erroneous for 51. For a format check, normal data fits the format (accepted) and abnormal data breaks it (rejected): the reason mark needs that verdict.

Quick check

4 short questions on this note. See what has stuck, and where to look if something hasn't.

About 2 minutes

Build on this topic