Simple path and prime path software testing

Simple path

A simple path is a path in which any node can’t appear more than once but only starting and ending nodes can appear more than once.

Prime Path

The prime path is basically a simple path and it does not appear as a subpath of any other simple path.

round trip path
Figure: simple path, prime path

Simple Paths

In the figure, followings are the simple paths.

Length 0:

Following nodes represents simple paths with length 0 because having no outgoing edge.

Simple paths = [0], [1], [2], [3]

Length 1:

Following nodes represents simple paths with length 1 because having  total 1 outgoing edge.

Simple paths = [ 0, 1], [ 0, 2 ], [ 1, 3 ], [ 2, 3 ], [ 3, 0 ],

Length 2:

Following nodes represents simple paths with length 2 because having total 2 outgoing edges.

Simple paths = [ 0, 1, 3 ], [ 0, 2, 3 ], [ 1, 3, 0 ], [ 2, 3, 0 ],[ 3, 0, 1 ], [3, 0, 2 ],

Length 3:

Following nodes represents simple paths with length 3 because having total 3 outgoing edges.

Simple paths = [ 0, 1, 3, 0 ], [ 0, 2, 3, 0], [ 1, 3, 0, 1 ], [ 2, 3, 0, 2 ], [ 3, 0, 1, 3 ], [ 3, 0, 2, 3 ], [ 1, 3, 0, 2 ],[ 2, 3, 0, 1 ].

Prime Paths :

All of the following simple paths are the prime path.

[ 0, 2, 3, 0], [ 0, 1, 3, 0 ], [ 2, 3, 0, 2 ],  [ 1, 3, 0, 1 ], [ 3, 0, 2, 3 ], [ 3, 0, 1, 3 ], [ 2, 3, 0, 1 ] , [ 1, 3, 0, 2 ]

Round-Trip Path

A Round-Trip Path is a path that starts and ends with the same nodes.

Prime path coverage criteria(PPC)

According to prime path coverage(PPC), each prime path must be covered in test requirements.

Some facts about PPC:

  • PPC subsumes node coverage.
  • PPC subsumes edge coverage.