7.6

7.6 Suitable Test Data

Understanding how to suggest and apply suitable test data, including normal, abnormal, extreme and boundary data.

Learning Objectives

By the end of this lesson, you will be able to:

  • Definewhat is meant by "suitable test data"
  • Describethe four categories of test data: normal, abnormal, extreme and boundary
  • Suggestsuitable test data for a given program or scenario
  • Applytest data to check that a program works as intended
  • Compareactual results with expected results
  • Explainwhy each value was chosen as test data

Key Terms

Suitable test data

Specially chosen data to test the functionality of a program or design. Results are compared to expected results to check if the algorithm works as intended.

Normal data

Data that should be accepted by the program without causing errors.

Abnormal data

Data that is the wrong data type or in the wrong format. It should be rejected by the program — this includes no input when one is expected.

Extreme data

The maximum and minimum values of normal data that are accepted by the system.

Boundary data

Data that is the largest/smallest acceptable value as well as the corresponding smallest/largest rejected value — values on either side of the extreme.

No data

A special case where nothing is entered — not strictly invalid or abnormal, but certainly not what you want the user to do.

1. What is Suitable Test Data?

Suitable test datais specially chosen to test the functionality of a program or design. Developers or test-users would pick a selection of test data from the following categories:

Normal

Abnormal

Extreme

Boundary

The results would be compared to theexpected resultsto check if the algorithm or program works as intended. Each category is explained within the context of a simple Python program below.

Python Example: Age Check

# Ask for user's name
name = input("What is your name?")
# Ask for user's age
age = int(input("How old are you?"))
# Check if age is between 12 and 18
if age >= 12 and age <= 18:
print("Welcome, " + name + "! Your age is accepted.")
else:
print("Sorry, " + name + ". Your age is not accepted.")

1.1 Normal Data

Normal data

Normal test data is data thatshould be acceptedin the program.

Example:A user entering their age as16into the age field of the program.

1.2 Abnormal Data

Abnormal data

Abnormal test data is data that is thewrong data typeor format. It should be rejected by the program.

Example:A user entering their age as"F"into the age field of the program.

1.3 Extreme Data

Extreme data

Extreme test data is themaximum and minimum values of normal datathat are accepted by the system.

Example:A user entering their age as18or12into the age field of the program.

1.4 Boundary Data

Boundary data

Boundary test data is similar to extreme data except that the valueson either side of the maximum and minimum values are tested.

The largest and smallest acceptable value is tested as well as the largest and smallest unacceptable value.

Example:A user entering their age as11or19into the age field of the program.

1.5 Selecting Suitable Test Data

Type of TestInputExpected Output
Normal14Accepted
Normal16Accepted
Extreme12Accepted
Extreme18Accepted
AbnormalHRejected
Abnormal@Rejected
Boundary11Rejected
Boundary19Rejected

Interactive: Test the Age Check Program

The program accepts ages between 12 and 18 (inclusive). Try entering each of the test data values below and see whether the program accepts or rejects them.

Program output will appear here.

How it works:Enter a value to see whether the program accepts or rejects it. Try each category to see the different types of test data in action.

Activity 1: Categorise the Test Data

A program asks the user for a percentage mark (0–100 inclusive). Classify each of the following values as normal, abnormal, extreme or boundary:

  1. 55
  2. 0
  3. 100
  4. -1
  5. 101
  6. "abc"
Solution:
  1. Normal— 55 is a typical value in the accepted range.
  2. Extreme— 0 is the minimum acceptable value.
  3. Extreme— 100 is the maximum acceptable value.
  4. Boundary— -1 is the value just below the minimum acceptable value and should be rejected.
  5. Boundary— 101 is the value just above the maximum acceptable value and should be rejected.
  6. Abnormal— "abc" is the wrong data type and should be rejected.

Check Your Understanding: Test Data Categories

Answer
  • [1 mark]Specially chosen data used to test the functionality of a program or design
  • [1 mark]Results are compared to expected results to check whether the algorithm/program works as intended
Answer
  • [1 mark]Normal
  • [1 mark]Abnormal
  • [1 mark]Extreme
  • [1 mark]Boundary
Answer
  • [1 mark]Abnormal data is data that is the wrong data type or in the wrong format
  • [1 mark]It should be rejected by the program — includes no input when one is expected
  • [1 mark]Example: entering "F" or "@" instead of a number for an age field
Answer
  • [1 mark]Extreme data is the maximum and minimum values that areacceptedby the system
  • [1 mark]Boundary data is the valueson either sideof the extreme values — the largest/smallest acceptable value and the corresponding smallest/largest rejected value
  • [1 mark]Example: if ages 12–18 are accepted, then 12 and 18 are extreme data, while 11 and 19 are boundary data (they should be rejected)
Answer
  • [1 mark]No data being entered isn't strictly invalid or abnormal, but it isn't what you want the user to do
  • [1 mark]Testing with no data ensures the program handles blank input gracefully without crashing
Answer
  • [1 mark]Normal data only shows the program works for typical inputs — it does not check boundaries or error handling
  • [1 mark]Abnormal data checks the program rejects wrong data types without crashing
  • [1 mark]Extreme and boundary data check the edges of the acceptable range are handled correctly

3. Case Study: Car Park Ticket Machine

What data could be used for this car park ticket machine software?

Birmingham Town Hall Car Park — Charges & Opening Times

Opening Times:

  • Monday to Saturday: 7am to midnight
  • Sunday: 9am to midnight
  • Vehicles cannot be retrieved when car park is closed

Monday to Saturday charges:

  • Up to 1 hour: £1.00
  • Up to 2 hours: £2.10
  • Up to 3 hours: £3.10
  • Up to 4 hours: £4.30
  • Up to 6 hours: £6.40
  • More than 6 hours and up to 24 hours: £9.20

Evenings (after 6pm until midnight): £2.50

Sunday (all day, until midnight): £2.50

Shoppers arriving after 9:30am (up to 5 hours): £3.00

Additional charge for lost or damaged cards: £10.50

Use 10p, 20p, 50p, £1, £2 coins and/or £5, £10, notes only

3.1 Suitable Test Data for Car Park System

What data could be used for this car park ticket machine software?

½ hour parking

1 hour parking

1½ hour parking

Sunday parking

Evening parking past 7pm

Parking before 9:30am

Parking after 9:30am

Parking during invalid opening hours

Why so many test values?

This program has many rules — different charges apply depending on the day, the time, and how long the car is parked. To test it thoroughly, the developer needs to try values that cover every rule: normal values within each pricing band, boundary values at the edge of each band, extreme values (the shortest and longest allowed parking times), and abnormal values (invalid times, wrong data types, invalid opening hours).

Check Your Understanding: Car Park Case Study

Answer
  • [1 mark]It is a value within the "up to 1 hour" pricing band, testing the lower end of that band
  • [1 mark]It checks the system handles part-hour parking correctly and charges the correct amount (£1.00)
Answer
  • [1 mark]2 hours exactly is the boundary of the "up to 2 hours" band — it should be accepted at £2.10
  • [1 mark]2 hours 1 minute would be a boundary value just outside this band, falling into the "up to 3 hours" band at £3.10
Answer
  • [1 mark]The car park is closed outside its opening times, so parking during those hours is not a valid scenario
  • [1 mark]The system should reject the input or handle it as an error rather than processing a charge
Answer
  • [1 mark]The car park system has many more rules — different charges depending on day, time, and duration
  • [1 mark]Each pricing band and opening-hour rule needs its own normal, extreme and boundary tests
  • [1 mark]Thorough testing is needed to ensure correct charges are calculated and invalid inputs (closed hours, wrong coin types, etc.) are handled properly

4. Worked Example & Past Paper Practice

Worked Example: Prices Less Than $10.00

A programmer has written an algorithm to check that prices are less than $10.00. These values are used as test data:10.00,9.99,ten.

State why each value was chosen as test data. [3 marks]

Show Mark Scheme

Answer (3 marks):
  • [1 mark]10.00is boundary or abnormal data and should berejectedas it is out of range (prices must beless than$10.00, so 10.00 exactly is not allowed)
  • [1 mark]9.99is boundary, extreme and normal data and should beacceptedas it is within the normal range (it is the maximum acceptable value)
  • [1 mark]tenis abnormal data and should berejectedas it is the wrong value type (a string, not a number)

Past Paper Style Question: Password Validation

A program asks the user to create a password. The password must be between 8 and 16 characters long (inclusive).

Suggest suitable test data for this program and state the expected result for each value.

Show Mark Scheme

Example Answer:
Type of testInputExpected output
Normal"Password123" (11 chars)Accepted
Extreme8-character passwordAccepted
Extreme16-character passwordAccepted
Boundary7-character passwordRejected
Boundary17-character passwordRejected
Abnormal(blank / no data)Rejected

Key Takeaways

  • Suitable test datais specially chosen to test the functionality of a program or design.
  • There arefour main categoriesof test data: normal, abnormal, extreme and boundary.
  • Normal datais data that should be accepted without causing errors.
  • Abnormal datais data that should be rejected — it is the wrong data type or format, and includes no input when one is expected.
  • Extreme datais the maximum and minimum values that are accepted by the system.
  • Boundary datais the largest/smallest acceptable value as well as the corresponding smallest/largest rejected value — values on either side of the extreme.
  • No datashould always be tested as a special case, since it's not what you want the user to do.
  • Results are compared toexpected resultsto check whether the algorithm/program works as intended.
  • Programs with many rules (e.g. a car park ticket machine) needmore test valuesto cover every pricing band, opening-hour rule and edge case.
  • Testing with only normal data isnot enough— abnormal, extreme and boundary tests are needed to fully verify the program.

Question Bank

Answer
  • [2 marks]Suitable test data— specially chosen data used to test the functionality of a program or design; results are compared to expected results
  • [1 mark]Normal data
  • [1 mark]Abnormal data
  • [1 mark]Extreme data
  • [1 mark]Boundary data
Answer
TypeInputExpected
Normal45Accepted
Normal72Accepted
Extreme0Accepted
Extreme100Accepted
Boundary-1Rejected
Boundary101Rejected
Abnormal"abc"Rejected
Abnormal#Rejected

Marking:1 mark per correct row (2 per category), max 8.

Answer
  • [2 marks]Extreme datais the maximum and minimum values of normal data that areacceptedby the system
  • [2 marks]Boundary datais the values on either side of the maximum and minimum — the largest/smallest acceptable value as well as the smallest/largest rejected value
  • [Example]If the accepted range is 12–18: 12 and 18 are extreme data (accepted); 11 and 19 are boundary data (rejected).
Answer
TypeInputExpected output
Normal3Accepted
Extreme1Accepted
Extreme5Accepted
Boundary0Rejected
Boundary6Rejected
Abnormal"X"Rejected

Marking:1 mark per correct row, max 6.

Answer
  • [1 mark]10.00is boundary or abnormal data and should be rejected as it is out of range (prices must be less than $10.00)
  • [1 mark]9.99is boundary, extreme and normal data and should be accepted as it is within the normal range (maximum acceptable value)
  • [1 mark]tenis abnormal data and should be rejected as it is the wrong value type
Answer
  • [1 mark]No data being entered isn't strictly invalid or abnormal, but it isn't what you want the user to do
  • [1 mark]Testing this case ensures the program handles blank input gracefully without crashing or producing unexpected results
Answer
  • [1 mark]Normal data only shows the program works for typical inputs — it does not test the boundaries
  • [1 mark]It does not check whether the program correctly rejects invalid (abnormal) inputs
  • [1 mark]Extreme and boundary tests are needed to make sure the edges of the acceptable range are handled correctly
Answer
  • [1 mark]Just over 1 hour (e.g. 1 hour 1 minute) — the lower boundary of the "up to 2 hours" band, charged at £2.10
  • [1 mark]Exactly 2 hours — the upper boundary of the "up to 2 hours" band, still charged at £2.10
  • [1 mark]Just over 2 hours (e.g. 2 hours 1 minute) — just outside the band, charged at £3.10 (moves into "up to 3 hours" band)
  • [1 mark]These values test the edges of the pricing band, confirming the system charges the correct amount at each boundary