TOPIC 3.4 PROGRAM TESTING

Set search flag on

while not end of table and search flag on

    if name = 'OLIVER'

    then print name

            set search flag off

     endif

  endwhile

  if search flag on

  then print 'OLIVER not in table'

  endif


OBJECTIVES OF TESTING

The objectives of testing can be stated in two basic questions:

1. Does the logic work properly?

2. Is all the necessary logic present?


TYPES OF TESTING

(1) FUNCTIONAL TESTING; and

(2) LOGICAL (STRUCTURAL) TESTING

 

FUNCTIONAL TESTING

  TEST PURPOSE EXPECTED RESULT
1 Enter 1587 Test valid data 3
2 Enter 9 digits 033514325 Test extreme case 3
3 Enter 10 digits 0335143256 Too many digits ?
4 Enter 154W Invalid digit 'Error - please redo from start'
5 Enter no digits Extreme case ?

LOGICAL (STRUCTURAL) TESTING


TESTING STRATEGIES

The two most common testing strategies are:

1) BOTTOM-UP TESTING

2) TOP-DOWN TESTING


DESIGNING A TEST PLAN

Good testing requires:

Note:

Data at the extreme of ranges - as this is here a large number of errors occur (e.g. if you have a statement: "If age>= 21 then do something", test it three times with age = 20, 21 and 22)
Invalid data - just outside valid ranges, or of the wrong type (character rather than numeric, etc) as well as valid data

PROGRAM ERRORS

A program may have any or all of four types error:

(1) Syntax error

        Writteln('This statement contains 2 syntax errors);

         (misspelt keyword and missing quote-mark)

(2) Semantic error

        Num1 := 'John Robert Sharpe' {Num1 being an integer variable}

(3) Logic error

        Net := Gross + Tax;

       when the statement should have been written below:

       Net := Gross - Tax;

(4) Run-time error

NOTE:


DESIGNING TEST DATA/TEST CASES

        (1) Components (subprograms) need to be individually tested to ensure that they conform to specifications.

        (2) When combined to form a program, the components must not act in unexpected ways, so each program module must be tested.

        (3) The suite of programs as a hole must be tested to ensure that al programs integrate correctly.

            - Every statement in the program is executted at least once.

            - The effectiveness of all sections of codde which detect invalid input is tested.

            - The accuracy of all processing is verifiied.

            - The program operates according to its orriginal design specifications.

            1. NORMAL DATA - data that the program is designed to handle;

            2. EXTREME VALUES - valid data at the limits of acceptability;

            3. EXCEPTIONAL OR INVALID DATA - the programmer must assume that users sooner or later will attempt to enter invalid data, and the program must not as a consequence 'crash' or give wrong results.


RESOURCES:

1) P M Heatcote, [A level Computing, 3rd Edition], Ashford Colour Press Ltd, 1996.

2) P Heatcote & K Bond, [A Level Computing], Letts Educational Ltd, 1997.

Hosted by www.Geocities.ws

1