2.3.2
Testing
Testing is how programmers check that a program works properly and catches problems before users find them. You need to know why testing matters, the difference between iterative and final testing, the difference between syntax and logic errors, and how to choose strong test data and test plans.
On this page7 sectionsHide
What you need to know
- Explain the purpose of testing.
- Compare iterative testing and final testing.
- Distinguish between syntax errors and logic errors.
- Choose suitable normal, boundary, invalid, and erroneous test data.
- Create or complete a test plan.
Big Picture
Why we test and when we test
Testing is not a one-off job at the end of a project.

- Iterative testing happens as modules are created and improved.
- Final or terminal testing checks the completed program near the end.
- Testing helps confirm that changes have not broken existing behaviour.
Common Problems
Syntax errors and logic errors
Exam questions often ask you to identify which type of error has happened.
| Error type | What happens | Typical result |
|---|---|---|
| Syntax error | The rules of the language are broken | The program does not run or translate correctly |
| Logic error | The program runs but the logic is wrong | The output is incorrect |
Test Data
Normal, boundary, invalid, and erroneous data
Good test data checks not just typical cases, but edge cases and bad input too.
| Type | Meaning | Example if valid ages are 11 to 16 |
|---|---|---|
| Normal | Typical valid data | 14 |
| Boundary | Data on or just at the edge of validity | 11 or 16 |
| Invalid | Correct type but should be rejected | 20 |
| Erroneous | Wrong type of data | "blue" |
Boundary reminder
Boundary data is still the correct data type. Erroneous data is the wrong data type.
High-Value Exam Skill
Test plans and refining programs
A test plan helps a programmer check systematically whether the program behaves as expected.
- A test plan usually includes the test data, the expected result, and the actual result.
- If the actual result does not match the expected result, the algorithm or code may need refining.
- Refining means improving the algorithm after testing has shown a weakness.
Key takeaways
- Testing helps find problems and gives confidence that a program works correctly.
- Iterative testing happens during development, while final testing happens near the end.
- Syntax errors stop code from running correctly, while logic errors produce the wrong output.
- Good testing uses a range of test data, not just one happy-path example.
Glossary
- Iterative testing
- Testing carried out during development as the program is built.
- Final testing
- Testing carried out on the finished program.
- Syntax error
- An error caused by breaking the rules of the programming language.
- Logic error
- An error where the program runs but gives the wrong result.
- Boundary data
- Valid data at the edge of the allowed range.
Test yourself
4 questions
What is the purpose of testing?
To find problems and check that the program behaves as expected.
What is the difference between iterative and final testing?
Iterative testing happens during development, while final testing happens near the end.
What is the difference between invalid and erroneous data?
Invalid data is the correct type but should be rejected, while erroneous data is the wrong type entirely.
What should a test plan include?
Test data, the expected result, and the actual result.
Common questions
Why can a program still be wrong even if it runs?
Because it may contain a logic error, where the instructions work but the result is incorrect.
Why are boundary tests so important?
Because programs often fail at the edges of valid input, so testing the limits can reveal hidden problems.
What happens after testing finds a problem?
The code or algorithm is refined, corrected, and tested again.