Broadly we can identify 3 causes of error:
Consider the following program fragment where a "divide by zero" may be caused to occur.
procedure ADA_ERROR_EXAMPLE is X_VALUE, Y_VALUE, Z_VALUE: INTEGER; begin GET(X_VALUE); GET(Y_VALUE); Z_VALUE := X_VALUE/Y_VALUE; PUT("Result is"); PUT(Z_VALUE); NEW_LINE; end ADA_ERROR_EXAMPLE;
If the variable Y_VALUE is set to 0 a "divide by zero" error will occur.
There are various methods whereby commonly experienced errors can be classified. These can be summarised as follows.
Software testing is an essential element of the software development process. The objectives of software testing may be stated as follows (Myers 1979):
Remember that if no errors are discovered we cannot say that "the software in question is error free", all we can say is that "no errors have been discovered".
We can identify two distinct elements of software testing:
Verification refers to the set of activities that ensures that software is correctly implemented as a set of procedures/functions. Validation refers to a different set of activities that ensure that the software built is traceable to customer requirements. The distinction is sometimes described as follows (Bohem 1981):
Verification | "Are we building the product right?" |
Validation | "Are we building the right product?" |
Both parts of V&V can be carried out using appropriate test cases. Over the past two decades a rich variety of test case design methods have evolved for soft ware. These methods provide the developer with a systematic approach to testing. More importantly, they provide a mechanism that can help to ensure the completeness of tests and provide the highest likelihood for uncovering errors in software. We can identify two types of testing:
Black box testing is concerned with inputs to and outputs from software. Black box test cases are designed to demonstrate that :
Black box testing is not concerned with the internal operation of a software system only its interface activities/
White box testing is concerned with the internal operation of software systems. logical paths through the software are tested by providing test cases that exercise specific sets of conditions and/or loops. In addition the "status of the program" may be examined at various points to determine if the expected or asserted status corresponds to the actual status. The latter is normally carried out during the implementation process rather than subsequent to it. Typically test cases are generated to:
Given an input variable of some form we should derive test cases that include the lowest and highest possible values for the variable in question.
For reasons that are not completely clear a greater number of errors tend to occur at the boundaries of the input domain rather than in the enter. It is for this reason that Boundary Value Analysis (BVA) has been developed as a testing technique. BVA leads to a selection of test cases that exercise bounding values. Guidelines for BVA are as follows:
Arithmetic testing is only applicable for statements that incorporate arithmetic expressions. In this case test cases should be constructed whereby each variable in the expression is tested with a zero, negative and positive sample value (if the variable's definition permits this) against each other variable (also with a zero, negative and positive sample values).
This is concerned with the derivation of a set of test cases to exercise every statement in a program at least once during testing. Before appropriate test cases can be derived we must know how control may flow through our program. Their are specialised notations (flow graphs) which may be used for this. Alternatively we can refer to our design specification (e.g. Nassi-Shneiderman charts).
Loop testing is a white box testing technique that focuses exclusively on the validity of loop constructs (suggested by Beizer amongst others in the early 1980s - Beizer 1983). In addition to testing each path within a loop a specialised set of additional test are recommended depending on the type of loop:
Debugging occurs as a consequence of successful testing, i.e. when an error is discovered. Debugging is a four stage process:
Note that the last three stages are analogise to the stages in the software development process. Error location can be the most arduous stage in this process. The most straightforward and simplest method of locating the source of errors is through code inspections. If this fails output statements may be embedded in the code whereby values for key variables or messages are output (the latter indicating that specific stages in the processing have been reached). In this manner, through a process of elimination, sources of errors can be isolated.
Created and maintained by Frans Coenen. Last updated 11 October 1999