Selecting & Using Suitable Test Data (OCR GCSE Computer Science): Revision Notes
📚 Revision Notes
Selecting & Using Suitable Test Data
When testing a programme, test data is the input provided to check how the system behaves. To ensure that the programme works correctly and handles different types of inputs, it's important to use a variety of test data.
Types of Test Data
Normal/Valid Data
- Data that represents typical, expected input values.
- It should be accepted by the programme without causing errors.
- Example: For a range between 1-10, 5 is normal test data.
Boundary Test Data
- Data that is on the edge of being valid but still within the acceptable range.
- Used to ensure the programme can handle values at the upper or lower limits.
- Example: For a range between 1-10, 1 and 10 are boundary values.
Invalid Data
- Data that is the correct type but falls outside the valid range.
- The programme should reject this data.
- Example: For a range between 1-10, 0 or 11 would be invalid.
Erroneous Data
- Data that is the wrong type or completely unexpected (e.g., letters instead of numbers).
- The programme should reject such data.
- Example: Entering A when the programme expects a number.
Test Plan
A test plan outlines the approach for testing a programme, including what will be tested, the test data used, and the expected result. This ensures all possible input cases are covered and helps identify any issues in the programme.
Key Components of a Test Plan
- Purpose of the test: What are you testing (e.g., input validation, functionality)?
- Test data: The values you will input during the test.
- Expected result: What the programme should do in response to the test data.
Example Test Plan for Input Validation
| Test No | What is Being Tested | Test Data | Expected Result |
|---|---|---|---|
| 1 | Normal values inside the range are accepted | 5 (Valid) | Value is accepted |
| 2 | Values outside the range are rejected | 12 (Invalid) | Value is rejected |
| 3 | The last value in the range is accepted | 10 (Boundary) | Value is accepted |
| 4 | Values just outside the range are rejected | 11 (Invalid) | Value is rejected |
| 5 | Data of the wrong type is rejected | A (Erroneous) | Value is rejected |
infoNote
Key Points for Effective Testing
- Normal test data ensures the programme functions correctly with the expected input.
- Boundary test data checks how the programme handles the limits of the acceptable range.
- Invalid and erroneous data test whether the programme can correctly reject unsuitable inputs.