Unit 2: Flow Graphs and Path Testing
1. Flow Graphs (Control Flow Graphs)
A flow graph is a graphical representation of a program that shows:
The flow of control
Execution paths through the program
Components:
Nodes → Represent statements or blocks of code
Edges → Represent flow of control between nodes
Regions → Areas bounded by edges (used in complexity)
👉 Used to understand program structure and design test cases.
2. Path Testing
Path Testing is a white-box testing technique where:
All possible execution paths in a program are tested
Goal:
Ensure every logical path executes correctly
Key Idea:
Execute independent paths at least once
3. Achievable Paths
Not all paths in a program can be executed.
Achievable Path:
A path that can actually be executed with some input
Non-Achievable Path:
A path that can never occur
Example:
if (x > 10 AND x < 5)
→ Impossible condition → path not achievable
👉 Testing focuses only on achievable paths
4. Path Instrumentation
Definition:
Path instrumentation is the process of:
Adding extra code to track which paths are executed during
testing
Purpose:
Verify whether all required paths are tested
Monitor execution flow
Example:
Adding counters or print statements:
print("Path A executed")
👉 Helps in coverage analysis
5. Application Transaction Flow Testing
This technique is used for:
Business applications
Systems with user transactions
Transaction Flow:
Sequence of steps followed by a user action
Example:
Login → Select product → Payment → Confirmation
Testing Focus:
Valid and invalid transaction flows
Alternate paths (success/failure cases)
6. Transaction Flow Testing Techniques
1. Identify Transactions
List all possible user activities
Example: login, register, purchase
2. Build Transaction Flow Graph
Represent steps using nodes and edges
3. Analyze Paths
Identify:
o Normal flow
o Alternate flow
o Error flow
4. Design Test Cases
Cover:
o All major paths
o Boundary conditions
o Error handling
5. Execute and Validate
Check whether:
o Flow works correctly
o Outputs are as expected
7. Advantages of Path & Flow Testing
Detects logical errors
Ensures complete coverage
Improves software reliability
Useful for complex systems
Quick Summary
Flow Graph → Structure of program flow
Path Testing → Test all execution paths
Achievable Paths → Only executable paths are tested
Path Instrumentation → Tracks execution
Transaction Flow Testing → Tests real-world user flows