大象传媒

Testing and documenting solutions

This section includes:

  • constructing a test plan
  • comprehensive testing: Normal, Exceptional and Extreme Data
  • syntax, execution and logic errors
  • dry runs, trace tables, breakpoints and watchpoints
  • documentation during testing

Constructing a test plan

Regardless of the development methodology used, it is always necessary to test code before release. The main reasons for testing are:

  • to identify errors
  • to ensure that software is fit for purpose
  • to ensure that code is efficient
  • to ensure that code is maintainable

It is too simplistic to suggest that testing is only necessary to identify errors. Error free code could be inefficient or might not match the specifications set. However, it is the case that finding errors is the primary purpose of software testing.

Testing should follow a clear plan. This means that test data should have been prepared prior to implementation. It is common for some test data to be identified during the analysis stage of the development process.

A test plan will provide clear guidance on suitable test data that will be used during testing. To ensure that an appropriate range of data is tested it is common practice to follow the principles of comprehensive testing.

Comprehensive testing

Comprehensive testing describes the process of testing normal, exceptional and extreme data.

Example:

A program has been designed to store five scores between 1 and 25. All of the scores are held as integers.

Normal data

Normal data is regarded as data that should be accepted and handled correctly.

In this example any whole number between, but not including, 0 and 25 would be classed as normal data:

1, 2, 14, 11, 21, 24

Exceptional data

Exceptional data is data that should not be accepted but that should trigger feedback to the user. Sometimes data is exceptional because it is outside a set range. Exceptional data also includes data of a different data type.

The user should be informed that there is a problem with the data entered. Creating code that generates feedback to the user is known as error trapping.

In this example the following values would be classed as exceptional data:

拢4, four, beanie, ABC13, -2121

Extreme data

Extreme data is data that is on the limit of the acceptable range. In this example there are two values on the edge of the range:

0 and 25

Extreme data is often used to protect against logic errors and should test the extremes of acceptable data, for example the extreme values of a range. If a program contains selection statements such as nested IF statements or CASE statements, it will be necessary to test the extremes of each set of criteria used in the selection statement.

It is also important to know that extreme test data is NOT boundary testing. Sometimes extreme data is referred to as 鈥榖oundary testing鈥 but this is a little inaccurate. In the above example, boundary testing would test the extreme data of 0 and 50 but would also include -1 and 51.

Extreme data is only concerned with the lower and upper values in a range, in this case 0 and 50.

Related links