CS 250 Computer Programming and Problem Solving - FALL 1998 

[ Home | Syllabus | Notes | Glossary | CS250 WEB Version Home Page ]


Testing Software


Software Validation

Validation is the set of activities conducted to convince ourselves that the software performs as intended.

On successful large projects, validation may consume 50\% to 75\% of the total effort from Requirements Analysis till release.

 


Common Forms of Validation


Desk Checking

An exercise conducted by the individual programmer.

 


Code Reviews

 


Reliability Models

A statistical process for estimating the reliability of software.

For example, suppose that we track the amount of time we can run
without failures over a series of bug fixes:

  1. Bug 1 detected after 1 min.
  2. After fixing bug 1, we ran for 10 min before finding bug 2.
  3. After fixing bug 2 we ran for 2 hrs before finding bug 3.

We might guess that this program will run, on average, for over 20 hrs. before failing due to some unknown bug 4.


Reliability Models (cont)

Another approach is based upon deliberately "seeding" faults into the code. The code is tested, and the faults that are found are examined to see how many were "seeded" and how many were "real".

Suppose we seed a program with 10 faults. Someone else tests the code and finds 20 faults, 5 of which were ones that we seeded.

Since only 25% of the seeded faults were found, we estimate that the test data is so poor that
it has probably found only 25% of the real faults.

We conclude that 45 "real" faults remain in the code.


Testing

Testing is the act of executing a program with selected data to uncover bugs.

Fault
A defect in the source code.
Failure
An incorrect behavior or result.
Error
A mistake by the programmer, designer, etc., that led to the the fault.

Industry figures of 1-3 faults per 100 statements are quite common.

 


Testing by Time and by Scale

Unit Test
Tests of individual subroutines and modules, usually conducted by the programmer.
Integration Test
Tests of ``subtrees'' of the total project hierarchy chart --- groups of subroutines calling each other. Integration Testing is generally a team responsibility.
System Test
Test of the entire system, supervised by team leaders or by V&V specialists.
Many companies have independent teams for this purpose.
Regression Test
Unit/Integration/System tests that are repeated after a change has been made to the code.
Acceptance Test
A test conducted by the customers or their representatives to decide whether to purchase/accept a developed system.

Integration Testing


Top-Down Integration Testing

 


Skeleton Programs

 


Testing Process


Oracle

The oracle is the procedure for determining whether a failure has occured on some test.

Possible oracles include

"Partial" oracles consisting of debugging code within the program under test.


Test Plans

Test Plan When Developed
unit design
integration high-level design
system specification
acceptance requirements analysis

Testing Methods


Functional Testing

Attempt to choose test data illustrating each distinct behavior or each
distinct class of inputs at least once.

Example: parentheses matching:

Matching ( )
Matching { }
Matching [ ]
Multiple nested groups
Multiple unnested groups
No parenthetical groups
Missing left paren
Missing right paren


Boundary-Values Testing

Choose data at the boundaries of a functional testing class or of the overall input domain.

Example: parentheses matching:

No parentheses
Empty input string
Very long input string
Matching right paren as last character
Left paren as first character


Special-Values Testing

Choose data reflecting ``special'' or troublesome cases.

Examples include choosing for each numeric input negative, zero, and positive values, testing each string input with empty and entirely blank strings, etc.


Statement Coverage

Require that every statement in the code be executed at least once during testing.

Special programs (``software tools'') will monitor this requirement for you.


Methods and Times

Unit desk checking, structural,
special values, boundary values
Integration code review, functional,
special values, boundary values
System code (design) review, functional,
special values, boundary values, simulated data
Acceptance functional, real data,
boundary values, simulated data

 


Copyright chris wild 1998.
For problems or questions regarding this website contact [Chris Wild (e-mail:wild@cs.odu.edu].
Last updated: November 04, 1998.