Testing

Once the program has been written it is necessary to test the program for any errors. The testing stage can take quite a long time as the program must work under most conditions. ​

There are three types of testing: ​

Normal (N) – Data the program should expect to handle. ​

Extreme (L) – Data at the limits of what the program should handle. ​

Exceptional (E) – Data which the program should not handle

The aim of testing is to prevent software failure. Using normal, exceptional and extreme test data as part of a test plan will reduce the prevalence of syntax, logic and execution to errors in code.

Test Tables

Test tables are used to provide a structure to testing.

Programmers will often create a table with a selection of normal, extreme and exceptional data that they intend to use during testing. The table will include:

  • a column for the expected result
  • a column for what actually happens when the program runs

The programmer will refer to the functional requirements created at the analysis phase to act as a reminder of the inputs that the program is expected to handle.

What data to test

A test table should include:

  • at least two items of normal data
  • at least two items of exceptional data]
  • both extreme values if testing a range of numbers

It is also good practice to test the values immediately out with the accepted range as it is common to find errors that occur because of a selection statement that makes use of incorrect logical operators.

Syntax, Execution and Logic errors

There are three types of error that you need to understand.

Syntax error

The rule of the code is not being met, such as incorrect spelling, forgetting to include commas/speech marks. A syntax error will be identified by an interpreter and will stop the code when the error is found..

Execution error

Sometimes called a runtime error, execution errors only become evident during run time. An execution error occurs when a program is asked to do something that it cannot, resulting in a ‘crash’. The widely used example of a run time error is asking a program to divide by 0.

Logic error

The program will run, but the outputs will be wrong due to an incorrect calculation or using < instead of > or AND rather than OR.