Graphs Structural Coverage
Graphs Structural Coverage
Meenakshi D’Souza
Node/vertex coverage.
Edge coverage.
Edge pair coverage.
Path coverage
Complete path coverage.
Prime path coverage.
Complete round trip coverage.
Simple round trip coverage.
Node coverage
Node coverage requires that the test cases visit each node in
the graph once.
Node Coverage: Test set T satisfies node coverage on graph
G iff for every syntactically reachable node n ∈ G , there is
some path p in path(T ) such that p visits n.
Test requirement (TR) contains each reachable node in G .
Edge coverage
1
5
2 4
6
3
TR = {[1, 4, 5], [2, 4, 5], [3, 4, 5], [1, 4, 6], [2, 4, 6], [3, 4, 6]}.
Test paths are the same as above.
Covering Multiple Edges, contd.
3 Edge-pair coverage: TR =
{[1, 2, 3], [1, 3, 4], [1, 3, 5], [2, 3, 4], [2, 3, 5], [3, 4, 7], . . .},
4 5 Test paths:
6
{[1, 2, 3, 4, 7], [1, 2, 3, 5, 7], [1, 3, 4, 7], [1, 3, 5, 6, 5, 6, 5, 7]}.
7
Complete path coverage: TR =
{[1, 2, 3, 4, 7], [1, 2, 3, 5, 7], [1, 2, 3, 5, 6, 5, 7], . . .}.
Complete and Specified Path Coverage
2 3
1 2 3 4 5
6
Touring, side trips and detours
1 2 3 4 5
1 2 3 4 5
6
Touring the prime path with a side trip
1 2 3 4 5
Round trip path: A prime path that starts and ends at the
same node.
Simple round trip coverage: TR contains at least one round
trip path for each reachable node in G that begins and ends in
a round trip path.
Complete round trip coverage: TR contains all round trip
paths for each reachable node in G .
The above two criteria omit nodes and edges that are not in
round trips.
Hence, they do not subsume edge-pair, edge or node coverage.
Structural Coverage Criteria Subsumption
Node Coverage
Credits
Part of the material used in these slides are derived from the
presentations of the book Introduction to Software Testing, by
Paul Ammann and Jeff Offutt.