Iterative and final testing
Testing is essential to ensure a program behaves as expected. As sub-programs are developed, they will be tested to ensure that they work as expected. This is known as iterative
testing and may also involve limited models of the final program to ensure sub-programs interact as expected. Once the whole program is created, final testing ensures that the
modules work together so that the program behaves as expected and meets its objectives.
Types of errors
The two types of errors you need to be familiar with identifying through testing are:
- Syntax errors: Errors which break the
grammatical rules of the programming language and stop the code from being run.
- Logic errors: Errors which produce unexpected output but don’t prevent the code from being
run.
The code below is meant to output the average of all the numbers in an array called scores.
The first is a logic error as it fails to include the first item in the array but the code would still run. The second is a syntax error. In trying to concatenate a string and
a real number it breaks the rules of the progamming language throwing up an erro that prevents the code from running.
Test plan
A suitable test plan will cover normal, boundary, invalid and erroneous data. A test plan generally includes:
- The data to be used
- A description of the test to be carried out
- The expected result
- Space to write the actual result
- Space to describe any needed changes