You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson covers the selection and use of test data as required by OCR J277 Section 2.4. To test a program effectively, you need to choose appropriate test data that covers all possible scenarios. OCR requires you to understand three types of test data: normal, boundary, and erroneous/invalid.
Using the right test data is critical because:
OCR Exam Tip: Test data questions are extremely common on Paper 2 and are typically worth 3–6 marks. You must know the three types of test data and be able to select appropriate examples for any given scenario.
Normal data (also called valid data or typical data) is data that the program should be able to handle — data that falls well within the acceptable range and is in the correct format.
Normal data tests that the program works correctly under typical conditions.
Example: For a program that accepts exam marks from 0 to 100:
Boundary data tests the values at the edges of the acceptable range — the minimum and maximum values that should be accepted, and values just outside the range that should be rejected.
Boundary testing is crucial because many bugs occur at the boundaries of ranges (off-by-one errors).
Example: For marks from 0 to 100:
| Value | Type | Expected Result |
|---|---|---|
| -1 | Just below lower boundary | Rejected |
| 0 | Lower boundary (valid) | Accepted |
| 1 | Just above lower boundary | Accepted |
| 99 | Just below upper boundary | Accepted |
| 100 | Upper boundary (valid) | Accepted |
| 101 | Just above upper boundary | Rejected |
OCR Exam Tip: When asked for boundary test data, always give values ON the boundary AND values just outside the boundary. For a range of 0–100, give: -1 (rejected), 0 (accepted), 100 (accepted), 101 (rejected). This tests that the boundaries are implemented correctly.
Erroneous data (also called invalid data) is data that should be rejected by the program. It is data that is the wrong type, format, or is otherwise unacceptable.
Erroneous data tests that the program's validation works correctly and handles bad input without crashing.
Example: For a program that accepts exam marks (integer, 0–100):
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.