• Software Testing Dictionary
  • Home

Software Testing - Control Flow Path



Software testing can be categorized into two major techniques white box and black box testing. In white box testing, the interior of the code is verified. Control flow path is one of the concepts under white box testing. It is a graphical representation of the flow of the software code and shows every path that can be traversed while running the code.

What is a Control Flow Path?

The control flow path testing is a structural testing of the software code. The testers should have the knowledge of the code structure, design, implementation logic, algorithm in order to carry out the control flow path testing. However, it is mostly covered by the developers themselves who have actually implemented the code. The entire implementation logic, and how individual modules of a software are interconnected are tested in this approach.

Process of Control Flow Path Testing

The process of the control flow path testing is listed below −

  • Creation of Control Flow Graph − From the available piece of code, a control flow graph is created manually or by using a tool.
  • Coverage Target − A coverage target is described in the control flow graph taking help of the nodes, edges, paths, branches etc.
  • Creation of Test Cases − The test cases are created covering all the coverage targets.
  • Execution of Test Cases − The test cases are executed.
  • Analysis of Test Results − The results of the test cases execution are compared to confirm if there are errors in the software.

What is a Control Flow Graph?

The control flow graph is known as the graphical representation of the complete flow of the program code. It is primarily used for static analysis and compiler software since it portrays the entire course of the code.

Characteristics of Control Flow Graph

The characteristics of a control flow graph are listed below −

  • It is driven by the complete process followed in the program code.
  • It discovers every path that can be covered while running the code.
  • It is a complete directed graph.
  • Its edges describe the paths that can be traversed, and nodes describe the basic blocks.
  • It has two sections namely the entry block which directs to the point of entry to the control flow graphs, and the exit block which directs to the point of exit from the control flow graph.

Different Components of Control Flow Graph

The different components of a control flow graph are listed below −

If-then-else Block

If-then-else Block

While Block

While Block

Do While Block

Do While Block

For Block

For Block

Example

Let us take an example of the below block of code from where we would draw the control flow graph.

IF I = 250
   THEN IF J > K
   THEN I = J
ELSE I = K
   END IF
END IF
PRINT I

The control flow graph of the above lines of code is given below −

control flow graph

Objectives of Control Flow Testing

The objectives of the control flow testing are listed below −

  • It ensures that all the paths of the code have been traversed at least once.
  • It ensures that all the conditional points of the code are gauged as false and true at least once.
  • It ensures that all the probable results of the conditions are touched by running each of the condition points in the code at least once.
  • It analyzes how the code runs in various use cases, namely zero, single, and multiple iterations.
  • It checks how the exception handling is done in the code.
  • It evaluates both easy and complex conditions in the decision statements.
  • It reduces the cyclomatic complexity of the code.
  • It verifies how different components of the software communicate with each other after their integration.
  • It verifies how the code reacts when the extreme boundary values are fed into the software.

Advantages of Control Flow Testing

The advantages of the control flow testing are listed below −

  • It detects the maximum number of bugs which will be identified during the unit testing phase.
  • It is also capable of detecting some portions of bugs which will be identified during the entire testing cycle.
  • It supports both manual and automation approaches since the control flow graph can be created both manually or with the help of tools.

Disadvantages of Control Flow Testing

The developer who developed the code is not always able to detect if he has covered all the paths in his own code during the control flow testing.

Conclusion

This concludes our comprehensive take on the tutorial on Software Control Flow Path. We’ve started with describing what is a control flow path, what is the process of the control flow path testing, what is a control flow graph, what are the characteristics of a control flow graph, what are the different components of a control flow graph, example of a control flow graph, what are the objectives of the control flow testing, what are the advantages of the control flow testing, and what are the disadvantages of the control flow testing. This equips you with in-depth knowledge of Software Control Flow Path. It is wise to keep practicing what you’ve learned and exploring others relevant to Software Testing to deepen your understanding and expand your horizons.

Advertisements