When we test a program, we use test data. You enter the test data as the inputs to the program. The data should try to capture a range of different scenarios - don’t just test the program with one piece of data.
There are three types of data you need to be able to use and give examples of: normal, extreme and exceptional. In this example, the program expects a number between 0 and 10 (inclusive).
We write this data into a test table. The test table shows the data we test the program with. We put one example in each row of the table (i.e. don’t say “anything between 1 and 9” - pick one!)
In the test table, you should say what you expect the program to do. Some test tables have another column for what actually happened, and you would record this afterwards.
There are three types of programming errors that you need to know about - syntax, logic and execution.
If you’re given an example of an error, you need to be able to say what type it is.
Syntax and logic errors occur when you are writing the program; execution errors happen when the program is running. Of these, syntax errors are usually the easiest to spot.
Syntax errors are quite common. You will already have experienced lots of these!
A syntax error occurs when the program does not follow the rules of the programming language. This stops the program from running.
Syntax errors are about breaking the rules of the language in some way.
A logic error occurs when the program runs without crashing, but the output is incorrect due to a mistake in the logic of the program.
A program can translate all of its code without errors (including no run-time errors) but still not give correct results because of an error in the logic of the instructions.
For example, writing code to add two numbers instead of multiplying them, or subtracting two numbers the wrong way around.
The order of your code must be logical too; let’s look at an example…
In line 1 the variables number1 and number2 have not yet been assigned a value, so they are initially set to 0.
Regardless of the input in lines 3 and 4, the variable answer will always 0, because it was calculated as 0 in line 1. Therefore the answer outputted will always be 0.
Line 1 answer = number1 + number2
Line 2 number1 = InputBox (“Enter number 1”)
Line 3 number2 = InputBox (“Enter number 2”)
Line 4 MsgBox (“The answer is “ & answer)
An execution error (or run-time error) happens when the program starts running but crashes due to an unexpected situation, such as dividing by zero or trying to open a missing file.
You have to be able to evaluate a program - either yours, or one you’re given - in four categories:
Fitness for purpose
Efficient use of coding constructs
Robustness
Readability
If your program is fit for purpose, it means it does exactly what it’s supposed to do. To determine this, refer to the original functional requirements outlined in the analysis stage. If a program meets all of them, it is fit for purpose. If it fails even one requirement, it is not fit for purpose.
Examples:
✅ Fit for purpose: A program correctly asks the user their age and rejects negative inputs.
❌ Not fit for purpose: A program that should only accept percentages (0-100) but allows numbers outside this range.
🔸 Edge case example: A program meant to accept only whole numbers but mistakenly allows decimals—this is a small mistake but still makes it not fit for purpose.
Efficiency in programming means achieving maximum functionality with minimal wasted effort or resources. A more efficient program runs faster, takes up less memory, and uses fewer lines of code without unnecessary repetition.
Ways to improve efficiency:
Use loops instead of writing the same line of code multiple times.
Use if-elif-else statements instead of multiple individual if statements.
Consider time complexity (how long the program takes to run) and space complexity (how much memory it uses).
A robust program doesn’t crash when unexpected or invalid data is entered. It can handle errors gracefully and guide the user to input valid data instead of stopping suddenly.
How to test robustness:
Use exceptional test data (e.g., entering text instead of a number, entering very large values, etc.).
Ensure the program validates inputs properly and provides meaningful error messages.
Consider edge cases (e.g., what happens if a user enters 0, a negative number, or an extremely large value?).
💡 Example:
✅ Robust: A program asks for a number and gives an error message if the user enters a letter.
❌ Not robust: The program crashes when a letter is entered because it wasn’t expecting it.
A readable program is one that another programmer can easily understand and modify. Poorly written code can be difficult to debug and maintain.
Ways to improve readability:
Internal commentary – Add comments explaining key parts of the code.
Meaningful identifiers – Use clear variable names (user_age instead of a).
White space & indentation – Properly format code to separate sections and improve clarity.
Using comments, meaningful variable names, and proper indentation makes the code much clearer.