Java Reference
In-Depth Information
logic/semantic errors
Logic or semantic errors are the hardest to detect since the program will give an output and not
generate an error. However, the output that is given is incorrect due to a formula being incorrectly
programmed. Consider the BMI example again:
public void calculate(){
BMI = (weight*weight) / height;
}
This routine is clearly erroneous since it calculates the BMI as (weight*weight)/height instead of
weight/(height*height). These errors cannot be detected by compilers or interpreters.
principles of softWare testing
In order to avoid software errors (and their impact), a program should be thoroughly tested for
any remaining errors before it is brought into production. The main purpose of testing is verifica-
tion and validation of the software build. Verification aims at answering the question as to whether
the system was built correctly, whereas validation tries to determine whether the right system was
built. The quicker an error is found during development, the cheaper it is to correct it. As illustrated
in Figure 1-4, the cost of testing typically increases exponentially, whereas the cost of missed bugs
decreases exponentially with the amount of testing conducted. The optimum testing resources can
then be found where both curves intersect.
Cost of missed
bugs
Cost of testing
Undertesting
Overtesting
Optimum
Amount of testing
figureĀ 1-4
A first basic way of testing is to desk-check the program by using paper and pencil. The manual
calculations and output can then be contrasted with the program calculations and output. It is
especially important to consider extreme cases and see how the program behaves. Of course, this
only works for small-scale programs; more sophisticated procedures might be needed for bigger
programs.
 
Search WWH ::




Custom Search