0% found this document useful (0 votes)
6 views15 pages

Module 4 Part 1

Module 4 of the Software Testing course focuses on path testing strategies, including the use of control flow graphs and test coverage metrics to assess test quality. It covers concepts such as cyclomatic complexity, which measures the complexity of a program's control flow, and differentiates between path testing and basis path testing. Students will learn to implement these techniques to improve test case generation and debugging.

Uploaded by

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

Module 4 Part 1

Module 4 of the Software Testing course focuses on path testing strategies, including the use of control flow graphs and test coverage metrics to assess test quality. It covers concepts such as cyclomatic complexity, which measures the complexity of a program's control flow, and differentiates between path testing and basis path testing. Students will learn to implement these techniques to improve test case generation and debugging.

Uploaded by

Ms. Moumita Roy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 15

Centre for Distance and Online

Education (CDOE)

SOFTWARE TESTING
(OPGDST402)
MODULE 4 Part 1
Centre for Distance and Online
Education (CDOE)

Syllabus
Centre for Distance and Online
Education (CDOE)

Molude 4 Course Outcome


By the end of this module students should be able to:
•Understand and apply path testing strategies using control flow graphs.
•Use test coverage metrics (statement, branch, path) to assess test quality.
•Identify and analyze DD paths for simplifying test case generation.
•Implement slice-based testing for focused debugging and test data flow.
•Examine and interpret SATM systems to integrate testing with architecture.
•Clearly differentiate integration testing from system testing in terms of scope
and goals.
Centre for Distance and Online
Education (CDOE)

Path Testing

Path Testing is a white-box testing technique used in software


testing to ensure that all possible execution paths through a program's
code are tested at least once.

It helps in identifying logic errors, unreachable code, and missing


conditions.
Centre for Distance and Online
Education (CDOE)

Steps in Path Testing


• Draw the Control Flow Graph (CFG) from the code.
• Compute Cyclomatic Complexity (V(G)).
• Identify independent paths.
• Design test cases for each independent path.
Centre for Distance and Online
Education (CDOE)

Control Flow Graph (CFG)


A Control Flow Graph (CFG) is a visual representation of all paths that
might be traversed through a program during its execution.
Components:
•Nodes (Vertices):Represent individual statements or blocks of code
(sequential group of statements with no branches).
•Edges (Arrows):Represent the flow of control from one statement (node)
to another.
•Entry and Exit Nodes:The graph begins with an entry point (start of the
program) and ends at one or more exit points (end of execution paths).
Centre for Distance and Online
Education (CDOE)

Example
1. if A = 10 then
2. if B > C
3. A=B
4. else A = C
5. endif
6. endif
7. print A, B, C
Centre for Distance and Online
Education (CDOE)

Cyclomatic Complexity
• Cyclomatic Complexity is a software metric used to measure the
complexity of a program’s control flow.
• It tells us the number of independent paths through the source
code.
• This metric is crucial in white-box testing because it helps
determine the minimum number of test cases needed for full
branch/path coverage.
• It was introduced by Thomas McCabe in 1976.
Centre for Distance and Online
Education (CDOE)

Cyclomatic Complexity Formula


Cyclomatic Complexity (V(G))=E−N+2P
Where:
E = Number of edges in the Control Flow Graph (CFG)
N = Number of nodes (statements or decisions)
P = Number of connected components (usually 1 for a single
program)
Or, (V(G))=Number of decision points+1
Where decision points include: if, while, for, switch, case, catch, etc.
Centre for Distance and Online
Education (CDOE)

Example
1. if A = 10 then
2. if B > C
3. A=B
4. else A = C
5. endif
6. endif
7. print A, B, C
Centre for Distance and Online
Education (CDOE)

Cyclomatic Complexity Calculation


• Formula 1: (V(G))=E−N+2P
E=8, V=7, P=1
Therefore, V(G)=8-7+2=3
• Formula 2: (V(G))=Number of decision points+1
There are two ‘if’s in the code, hence number of decision points is
2. Therefore, V(G)=2+1=3
• So, to test this program minimum 3 testcases (independent paths)
should be generated.
Centre for Distance and Online
Education (CDOE)

Path Testing vs Basis Path Testing


While path testing is a general white-box testing technique that tests
all possible execution paths in a program, basis path testing is a
specific form of path testing that focuses on a basis set of
independent paths.
Centre for Distance and Online
Education (CDOE)
Centre for Distance and Online
Education (CDOE)

Summary
• Path Testing
• Control Flow Graph (CFG)
• Cyclomatic Complexity
• Basis Path Testing
Centre for Distance and Online
Education (CDOE)

Happy Studying !

You might also like