Testing and Selecting Test Data (AQA GCSE Computer Science): Revision Notes
Testing and selecting test data
What is testing?
When you write a programme, there's always a chance that mistakes or bugs have crept in, no matter how careful you've been. Testing is the process of carefully checking that your programme works exactly as it should in all different situations.
The main purpose of testing is to make sure that your programme functions as expected and meets all the requirements you were given. However, testing should also be destructive - this means you shouldn't just check that your programme works with good data, but you should actively try to break it! This might sound strange, but it's the only way to be confident that your programme is truly robust.
Destructive testing is a crucial concept in software development. Rather than just testing with "perfect" inputs, you deliberately try to break your programme by testing with unexpected, invalid, or extreme inputs. This approach helps you discover potential vulnerabilities and ensures your programme can handle real-world usage where users might not always provide ideal inputs.
For example, imagine you create a programme for a hot drinks machine that should give customers a selection of drinks for £1 each. It's not enough to just test it by putting in £1 and pressing a drink button. You need to test it destructively by trying things like putting in no money, trying to get a drink without paying, or seeing what happens when someone tries to get multiple drinks for one payment.
Test plans and test data
To test a programme effectively, you need a test plan. This is a detailed list that shows:
- All the tests you will carry out
- The test data you will use for each test
- What you expect to happen (the expected outcome)
A comprehensive test plan is essential for systematic testing. It ensures you don't miss important test cases and provides a clear record of what has been tested. This documentation is particularly valuable when working in teams or when you need to demonstrate that your programme has been thoroughly tested.
Test data should cover as many different situations as possible to ensure your programme works properly in all circumstances.
Types of test data
There are three main types of test data you need to use when testing any programme:
Normal test data
Normal test data (sometimes called typical test data) is data that you would expect from a user who is using your system correctly. This data should be:
- The right type (e.g., numbers when numbers are expected)
- Within the expected range
- Something a real user would reasonably enter
Your programme should accept this data without any problems and process it correctly.
Boundary test data
Boundary test data (sometimes called extreme test data) is data that is technically valid but sits right at the edge of what's acceptable. This type of data tests the limits of your programme.
Boundary values are often where programmes fail! Even though boundary data is technically valid, it's at the edges of acceptability where programmers commonly make mistakes. For example, off-by-one errors frequently occur at boundary conditions.
For example, if your programme accepts numbers between 0 and 100, then 0 and 100 would be boundary test data - they're still valid, but they're at the very edges of the acceptable range.
Your programme should still accept boundary data and handle it correctly, but these are the values most likely to cause unexpected problems.
Erroneous test data
Erroneous test data is data that should definitely be rejected by your programme. This includes data that is:
- The wrong type (like entering text when numbers are expected)
- Outside the acceptable range
- Invalid for any other reason
Your programme should detect this type of data and reject it properly, usually by showing an appropriate error message.
Practical example
Worked Example: Testing a Number Rounding Program
Let's look at a real example to understand how these three types of test data work together. Imagine you have a programme that accepts a number between 0 and 100, then rounds it to the nearest 10.

This table shows how you would plan tests for this programme:
- Normal data (47, 32): These are typical numbers a user might enter, well within the 0-100 range
- Boundary data (0, 100): These test the very edges of what's acceptable
- Erroneous data (-5, 150, "Twelve"): These should all be rejected - negative numbers, numbers too high, and text instead of numbers
Key points for exam success
When creating test plans, remember that simply listing test data isn't enough. You need to include:
- The actual data value you'll test
- What type of test data it is (Normal, Boundary, or Erroneous)
- A clear explanation of why you chose that data
- What you expect the programme to do with that data
Common Exam Mistake to Avoid
A common mistake is to use vague descriptions like "a number larger than 100" instead of giving a specific value like "150". Always use actual, specific values in your test plans. Examiners want to see concrete, testable data values, not general descriptions.

Key Points to Remember:
- Testing systematically checks that programmes work correctly in all situations
- Test plans list the data you'll use, the type of test, and expected results
- Normal test data should be accepted and processed correctly by the programme
- Boundary test data sits at the edges of validity but should still be accepted
- Erroneous test data should be rejected with appropriate error handling
- Always use specific values rather than vague descriptions in test plans
- Destructive testing actively tries to break the programme to find weaknesses