Testing

Course Content Specification

  • Describe, exemplify and implement a comprehensive final test plan to show that the functional requirements are met.
  • Identify syntax, execution, and logic errors at this level.

A philosophical view…

“Program testing can be a very effective way to show the presence of bugs, but it is hopelessly inadequate for showing their absence.”

Edsger W. Dijkstra 1972

The Humble Programmer (1972)

Test Data

When testing programs you have to use as wide a range of test data as possible. You should also ensure you test a range of types of data, they are detailed in the table below.

Types of Test Data - Extreme data can also be thought of as boundaries

Testing Table

Imagine a program that accepted and graded pass marks between 0 and 20, with a pass is 12 or more.

You should show for each input what the expected output is and the actual output and make a comment.

This may be as simple as ‘As Expected’. A sample is shown below:

A suitable test table

Types of Errors

When testing programs there will be errors (bugs) there are different types…

  1. Syntax
  2. Execution
  3. Logic

Syntax Errors

A syntax error is when the ‘grammar’ of the programming language isn’t followed such as a colon missed from the end of the while statement such as in the example below:

Logic Errors

A logic error is when instructions are not written in the correct order or an incorrect instruction is used.

These can be the most difficult to spot as the program will usually execute but give incorrect results.

Execution Errors

An execution error is any error that prevents the program from executing or continuing or if an import library/module cannot be found.

Such as running out of memory or dividing by 0.

Test Plan

The purpose of a test plan is to ensure that you are systematically and comprehensively testing your system

The test plan must test the functionality of the software

  • A successful test is one that finds errors!
  • Try to find the errors!

What are your test cases?

This can be thought of as the ‘user’ interaction with your system

  • What test data will you use - your system may not be populated. You may need to alter files or create data to test with.
  • What data will you use in your system to ensure that your tests are valid?