Community resourceWorksheet

J277 2.3.2 Test data and test plans

Part 6 of 7 · J277 2.3 · Producing robust programs

Choosing test data deliberately, and setting it out in a test plan with expected results.

Students will:

  • define normal, boundary, invalid and erroneous test data
  • choose values that sit on the edge of a stated rule
  • build a test plan with expected results
  • recognise when more than one label applies to a value
  • use an expected result to expose a fault

Inside: 5 explanation cells, 1 runnable Python task, 2 multiple-choice questions, 1 fill-in-the-blanks cell and 4 written answers. 21 marks, about 45 minutes.

Series: J277 2.3 · Producing robust programs, part 6 of 7.

Shared by Coding PathwayVerified teacher

  • 13 cells
  • About 45 minutes
  • CC BY-SA 4.0
  • Shared 17 Aug 2026
  • Updated 9 Sept 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

Test data and test plans

Good testing uses deliberately selected values rather than a few convenient examples. OCR defines four ideas that students must distinguish:

  • normal test data has a value that should be accepted without causing an error;
  • boundary test data has the correct data type and is on the very edge of being valid;
  • invalid test data has the correct data type but should be rejected;
  • erroneous test data has the incorrect data type and should be rejected.

OCR examination questions may group invalid and erroneous together because both should be rejected, but the specification defines them separately. A valid boundary value can also be normal because it should be accepted. If a question says “tick one or more”, consider whether more than one label applies.

A value from 1 to 100 inclusive

Examples of normal, boundary, invalid and erroneous test data for an integer from 1 to 100 The valid range runs from 1 to 100 inclusive. 1 and 100 are valid boundary values. 27 is a normal accepted value. 105 is invalid because it is an integer outside the range. The text hello is erroneous because it has the wrong data type. Accepted integers: 1 to 100 inclusive valid range 1 27 100 105 boundary and normal normal boundary and normal invalid “hello” is erroneous: wrong type
Multiple choice, several answers2 marks

A program accepts integers from 1 to 100 inclusive. The test value is 100. Choose two classifications that apply.

  • ANormal
  • BBoundary
  • CInvalid
  • DErroneous
Fill in the blanks4 marks
Complete the definitions. Data that should be accepted is label 1. Correctly typed data at the edge of validity is label 2. Correctly typed data that should be rejected is label 3. Wrongly typed data that should be rejected is label 4.
  • normal
  • boundary
  • invalid
  • erroneous
  • iterative
  • terminal
Multiple choice1 mark

A program accepts an integer quantity from 1 to 8. Which example is erroneous rather than invalid?

  • AThe integer `12`
  • BThe text `four`
  • CThe integer `0`
  • DThe integer `8`

Building a test plan

A test plan records what will be tested and what should happen. The expected result is written before the program is run. The actual result is recorded afterwards, then compared with the expectation to decide whether the test passed.

Test valueTest-data typeExpected resultActual resultPass or fail
4NormalAcceptedAcceptedPass
1Boundary and normalAcceptedRejectedFail
10InvalidRejectedRejectedPass

A failed test is useful evidence. It identifies behaviour that should be investigated and refined. The program is not “good” because most rows pass if an important boundary still fails.

Written answer4 marks

A ticket system accepts whole-number quantities from 1 to 8 inclusive. Complete a four-row test plan containing one normal value, one valid boundary value, one invalid value and one erroneous value. State the expected result for each.

Use a compact table with columns: value, type, expected result. Give specific values, not phrases such as ‘a number in range’.

Students type their answer here.

Use expected results to expose a fault

The function below should accept quantities from 1 to 8 inclusive. Before running it, predict the four results. Pay particular attention to 1 and 8.

Worked example
def quantity_is_valid(quantity):
    return quantity > 1 and quantity < 8

for test_value in [1, 4, 8, 9]:
    print(test_value, quantity_is_valid(test_value))
Written answer3 marks

The boundary tests reveal that the function rejects 1 and 8. Identify the logic error and write the corrected return statement.

The requirement says inclusive. Use operators that include both valid edges.

Students type their answer here.

Written answer4 marks

Explain the difference between invalid and erroneous test data using a program that accepts integers from 10 to 20.

Give one specific rejected value of each type and explain why each belongs to that category.

Students type their answer here.

Written answer3 marks

A test plan contains only the values 4, 5 and 6 for a quantity accepted from 1 to 8. Evaluate this test plan.

Identify what it tests, what important cases are missing and the consequence for confidence in the program.

Students type their answer here.

Review

Close your notes and define normal, boundary, invalid and erroneous data in one sentence each. Then sketch the five columns of a complete test plan and explain why expected results are written before actual results.