Control Structure Testing

Control Structure Testing

Control structure testing is a part of White Box Testing. It includes the following methods:

  1. Conditional Testing
  2. Loop Testing
  3. Data Validation Testing
  4. Branch Testing/Path Testing

Conditional Testing

It is an approach to design test cases to exercise the logical conditions contained in a program module of an application.

Loop Testing

Loop testing is a white box testing technique that focuses exclusively on the validity of a loop construct.

Types of Loops

  • Simple Loop
  • Nested Loop
  • Concatenated Loop
  • Unstructured Loop

loops types.gif

                                      Graphical Image of Types of Loops


Simple Loop Testing

A simple loop is tested in the following way:

  1. Skip the entire loop.
  2. Make 1 pass through the loop.
  3. Make 2 passes through the loop.
  4. Make m passes through the loop where m<n, n is the maximum number of passes through the loop.
  5. Make n, n-1, n+1 passes through the loop.
     

Nested Loop Testing

A nested loop is tested in the following way.

  1. Start the innermost loop.
  2. Conduct a simple loop test for the innermost loop.
  3. Work outward, conducting a test for the next loop keeping all other loops at a minimum.
  4. Continue until all the loops are tested.

Concatenated Loop Testing

To test the concatenated loops, the procedure is if the loops are independent then test them as simple loops otherwise test them as nested loops.

Unstructured Loop Testing

To test the unstructured loops we needs to restructure their design.

Data Validation Testing

In data validation testing it selects the test paths of a program according to the locations of definitions in the program. In this type of testing the each statement in a program is assigned a unique statement number and each function does not modify its parameter or global variables. In this type of testing the tester checks for the data which is calculated during the navigation on a different page and it is also known as data flow.

Branch Testing/Path Testing

A branch is the outcome of a decision, so branch testing simply measures which decision outcomes have been tested. In this testing it takes a more in-depth view of the source code.