Suitable Test Data (Cambridge (CIE) O Level Computer Science)

Revision Note

Robert Hampton

Written by: Robert Hampton

Reviewed by: James Woodhouse

Suitable Test Data

What is suitable test data?

  • Suitable test data is 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 the expected results to check if the algorithm/program works as intended

  • Each category is explained within the context of a simple Python program below, comments have been added to help explain the processes

Python

# 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.")

Normal data

  • Normal test data is data that should be accepted in the program

  • An example would be a user entering their age as 16 into the age field of the program

Abnormal data

  • Abnormal test data is data that is the wrong data type

  • An example would be a user entering their age as "F" into the age field of the program

Extreme data

  • Extreme test data is the maximum and minimum values of normal data that are accepted by the system

  • An example would be a user entering their age as 18 or 12 into the age field of the program

Boundary data

  • Boundary test data is similar to extreme data except that the values on 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

  • An example would be a user entering their age as 11 or 19 into the age field of the program

Selecting suitable test data

Type of Test

Input

Expected Output

Normal

14

Accepted

Normal

16

Accepted

Extreme

12

Accepted

Extreme

18

Accepted

Abnormal

H

Rejected

Abnormal

@

Rejected

Boundary

11

Rejected

Boundary

19

Rejected

Worked Example

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]

Answers

10.00 is boundary or abnormal data and should be rejected as it is out of range [1]

9.99 is boundary, extreme and normal data and should be accepted as it is within the normal range [1]

Ten is abnormal data and should be rejected as it is the wrong value type [1]

Last updated:

You've read 0 of your 5 free revision notes this week

Sign up now. It’s free!

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Robert Hampton

Author: Robert Hampton

Expertise: Computer Science Content Creator

Rob has over 16 years' experience teaching Computer Science and ICT at KS3 & GCSE levels. Rob has demonstrated strong leadership as Head of Department since 2012 and previously supported teacher development as a Specialist Leader of Education, empowering departments to excel in Computer Science. Beyond his tech expertise, Robert embraces the virtual world as an avid gamer, conquering digital battlefields when he's not coding.

James Woodhouse

Author: James Woodhouse

Expertise: Computer Science

James graduated from the University of Sunderland with a degree in ICT and Computing education. He has over 14 years of experience both teaching and leading in Computer Science, specialising in teaching GCSE and A-level. James has held various leadership roles, including Head of Computer Science and coordinator positions for Key Stage 3 and Key Stage 4. James has a keen interest in networking security and technologies aimed at preventing security breaches.