2.4.2_Program_testing
2.4.2_Program_testing
4 Software development
Page 1 of 7
2.4 Software development
e.g.MyArray(63)
Real number starts with Expression expected but '.' Illegal expression Include the leading 0 e.g.
decimal point found
MyReal := 0.34;
e.g. MyReal := .34;
Argument type does not Incompatible types Incompatible types
match parameter type when
Page 2 of 7
2.4 Software development
calling a subroutine
Expression operated on by Operator not applicable to Incompatible types Should be:
logical operators not this operand type
enclosed in brackets. until (Count = MAX) or
Found;
e.g.until Count = MAX or
Found;
Page 3 of 7
2.4 Software development
integer;
{Use int64 instead of integer to
make
this program work.}
begin
MillisecsPerDay := 24 * 60 * 60 *
1000;
Page 4 of 7
2.4 Software development
Some errors cannot be detected by the compiler and only become apparent at run time. For example, errors
which depend on the input from a user cannot be predicted by the compiler.
Page 5 of 7
2.4 Software development
When you have removed all the syntax errors, compile-time errors and run-time errors you may think it is
time to heave a huge sigh of relief - but don't forget that there may still be logical errors lurking in your
program.
Out-by-one (or off-by-one) errors are very common, hence the emphasis on boundary testing in computing
courses. The cause of the error is often the operator used, as in the first example below.
Page 6 of 7
2.4 Software development
Take frequent breaks; mistakes are more likely when you are tired.
If in doubt, check. Look at examples if you are unsure of the correct syntax. Read the checklists above
from time to time and be on the lookout for those mistakes.
Learn from your mistakes. Try to recognize the types of mistake you make most often and concentrate
on reducing those.
Do not rely on the compiler to find your mistakes; it will only find certain types of mistake.
Check the computer output carefully to make sure it is correct. Your tests should include normal,
boundary and erroneous data. See our sample test plan in the tutorial on testing.
Include checks in the program itself, such as validating the input and intermediate results.
Try your hand at spotting the errors in our selection of Programs to Debug. See how many of our
deliberate errors you are able to spot and fix.
Page 7 of 7