0% found this document useful (0 votes)
76 views2 pages

Basic Path Testing

Basic Path Testing is a white-box testing technique that verifies all possible execution paths in a program using its Control Flow Graph (CFG). The process involves calculating Cyclomatic Complexity, identifying independent paths, and designing test cases to cover each path. While it ensures full code coverage and helps find logic errors, it is not suitable for very large programs and can be time-consuming.

Uploaded by

murugaraj680
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views2 pages

Basic Path Testing

Basic Path Testing is a white-box testing technique that verifies all possible execution paths in a program using its Control Flow Graph (CFG). The process involves calculating Cyclomatic Complexity, identifying independent paths, and designing test cases to cover each path. While it ensures full code coverage and helps find logic errors, it is not suitable for very large programs and can be time-consuming.

Uploaded by

murugaraj680
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Basic Path Testing

Definition

Basic Path Testing is a white-box testing technique that checks all possible execution paths in a program to

ensure each path is tested at least once. It is based on the program's Control Flow Graph (CFG).

Steps in Basic Path Testing

1. Draw the Control Flow Graph (CFG).

2. Calculate Cyclomatic Complexity (V(G)).

V(G) = E - N + 2

3. Identify Independent Paths.

4. Design test cases to cover each path.

Example

Program:

1. Start

2. Read A, B

3. If A > B then

4. Print "A is greater"

5. Else

6. Print "B is greater"

7. End

Nodes = 6, Edges = 7

Cyclomatic Complexity: V(G) = 7 - 6 + 2 = 3

Independent Paths:

1. 1 -> 2 -> 3 -> 4 -> 7

2. 1 -> 2 -> 3 -> 6 -> 7


Basic Path Testing

Test Cases:

- A = 10, B = 5 -> A is greater

- A = 3, B = 7 -> B is greater

Advantages

- Covers all possible paths

- Finds logic errors

- Ensures full code coverage

Disadvantages

- Not suitable for very large programs

- Time-consuming

Conclusion

Basic Path Testing is a powerful testing technique that improves software quality by testing all logic paths. It

uses control flow graphs and is best for small to medium programs.

Diagram: Control Flow Graph Example


Yes
Simple CFG for the example program:

Start / Read A, B

End
If A > B
Print A is greater
No

Print B is greater

You might also like