Software Engineering
Home Planning Requirements Writing Hazard Analysis Requirement Analysis Config Control Software Design Software Testing Software Standards Basic Logic

Software Testing - Basis Paths

Consider this code:

PROCEDURE: PATH-COUNTER

WHILE NOT End-Of-File

  READ NEXT RECORD

  IF FIELD > 7 THEN

    PUT IN BIG-NUMBER BIN

  ELSE IF FIELD > 3 THEN

    PUT IN MID-NUMBER BIN

  ELSE

    PUT IN SMALL-NUMBER BIN

  END IF

END WHILE

A Basis Path is a unique path through a process, not counting iterations. Basis Paths are the atomic components of real-world paths.

The four basis paths are:

  1. 1 - 10
  2. 1 - 2 - 3 - 8 - 9 - 1 - 10
  3. 1 - 2 - 4 - 5 - 7 - 8 - 9 - 1 - 10
  4. 1 - 2 - 4 - 6 - 7 - 8 - 9 - 1 - 10

Test the four Basis Paths:

  1. No records (path a).
  2. F > 7 (path b).
  3. F between 3 and 7 (path c).
  4. F < 3 (path d).

NOTE: this only gives the number of basis paths - which does not consider loops. Boundary testing is required in addition to path testing, to test the three boundaries: F > 7, F < 3, and the loop counter for the number of remaining records.