3.2: Testing
Exam Board:
OCR
Specification:
2020
The main purpose of testing is to ensure that a program works correctly no matter what input has been entered by the user.
Other reasons to test a program include ensuring the user requirements have been met, errors have been removed and the program doesn't crash while running.​
Types of Testing
Iterative Testing
Iterative testing takes place during program development.
​
The programmer develops a module, tests it and repeats this process until the module works as expected.
Final Testing
Final testing, also known as terminal testing, takes place after development and before the program is released to the end user.
​
This testing takes place once all modules have been individually tested to ensure the whole program works as originally expected.
Programming Errors
Syntax Error
Logical Error
A syntax error is a mistake in the grammar or spelling of the program.
​
A syntax error will prevent the program from being compiled.
​
Examples:
Incorrect Spelling:
pront ("hello")
Incorrect punctuation:
print ("hello"(
A logical error is a mistake made by the programmer - the program still works but displays the wrong output.
​
Examples:
Incorrect calculation:
total = num1 - num2
print (total)
Incorrect variable printed:
age = 16
name = "Steve"
print ("Nice to meet you" , age)
Test Data
Test data is used to test whether a program is functioning correctly.
It should cover a range of possible and incorrect inputs, each designed to prove a program works or to highlight any flaws.
Three types of test data are:
​
​
Normal data - Sensible data that the program should accept and be able to process.
Boundary data - Data at the extreme boundary of any data ranges.
​
Invalid (AKA Erroneous) data - Data that the program cannot process and should not accept.

Questo's Questions
3.2 - Testing:
​
1. Give 3 reasons why programs are tested. [3]
​
2. What is the difference between iterative and final testing? [2]
​
3a. What is a syntax error? Give an example. [2]
3b. What is a logical error? Give an example. [2]
​
4. State and describe the three types of test data. [6]