Presentation is loading. Please wait.

Presentation is loading. Please wait.

SOFTWARE PRESENTATION ON Path Testing And Decision To Decision Path

Similar presentations


Presentation on theme: "SOFTWARE PRESENTATION ON Path Testing And Decision To Decision Path"— Presentation transcript:

1 SOFTWARE PRESENTATION ON Path Testing And Decision To Decision Path

2 Group Member - Payal Nigam Akash Deep Jain Abhilash Panday
Aarushi Gupta Vanshaj Dixit

3 Path Testing Path Testing is a structural testing method based on the source code or algorithm and NOT based on the specifications. It is a structured testing or white box testing technique used for designing test cases intended to examine all possible paths of execution at least once

4 Path Testing Techniques:
Control Flow Graph (CFG) - The Program is converted into Flow graphs by representing the code into nodes, regions and edges. Decision to Decision path (D-D) - The CFG can be broken into various Decision to Decision paths and then collapsed into individual nodes. Independent paths - Independent path is a path through a DD-path graph which cannot be reproduced from other paths by other methods

5 Decision-to-Decision (DD) path Graph
A decision-to-decision path, or DD-path, is a path of execution (usually through a flow graph representing a program, such as a flow chart) between two decisions. More recent versions of the concept also include the decisions themselves in their own DD-paths.

6 Properties From the definition we can conclude the following:
Every node on a flow graph of a program belongs to one DD-path. If the first node on a DD-path is traversed, then all other nodes on that path will also be traversed. The DD path graph is used to find independent path for testing. Every statement in the program has been executed at least once.

7 When we have a flow graph, we can easily draw another graph that is known as decision-to-decision or (DD) path graph, wherein we lay our main focus on the decision nodes only. The nodes of the flow graph are combined into a single node it they are in sequence.

8 Path Testing: Independent Paths
 How you can calculate the number of independent paths through any structured system?

9 Nodes = Decisions + Processes
Nodes are where anything can happen and so the full count of nodes are those places where decisions are being made and those places where a specific algorithm or bit of logic is being performed. There are then three equations that you can use to calculate the independent paths. Independent Paths = Edges – Nodes + 2 Independent Paths = Regions + 1 Independent Paths = Decisions + 1

10

11 Independent Paths = Edges - Nodes + 2 Independent Paths = 7 - 6 + 2
On the basis of Nodes Independent Paths = Edges - Nodes + 2 Independent Paths = Independent Paths = 3 On the basis of regions Independent Paths = Regions + 1 Independent Paths = 2 + 1 Independent Paths =3 On the basis of decisions Independent Paths = Decisions + 1

12 Example: Program to calculate gcd
public class gcd {   public static void main(String[] args) {     float x = Float.valueOf(args[0]);     float y = Float.valueOf(args[1]);     while (x != y) {       if (x > y)         x = x - y;       else y = y - x;     }     System.out.println("GCD: " + x);   } }

13 On the basis of nodes Independent Paths = Edges - Nodes +2 Independent Paths = Independent Paths = 3 On the basis of decisions Independent Paths = Decisions +1 Independent Paths = 2 + 1 On the basis of regions Independent Paths = Regions +1 Here are some tests: x = 1, y = 1 x = 1, y = 2 x = 2, y = 1 With that test data set… Test Case 1: Covers path 1, 6 Test Case 2: Covers path 1,2,3,4,5,1,6 Test Case 3: Covers path 1,2,4,5,1,6

14 Process of constructing the DD Graph goes like this:
Step – 1: Start writing the following C – program # include (1) int main ( ) (2) { (3) int a, b, c, boolean = 0; (4) printf ("nt Enter side-a :"); (5) scanf ("%d", & a); (6) printf("nt Enter side-b :"); (7) scanf ("%d", & b);

15 (8) printf ("nt Enter side-c:"); (9) scanf (‘'%d", & c); (10) if ((a > 0) && (a < - 100) && (b > 0) && (b < . 100) && (c > 0) && (c < =100)) { (11) if ((a + b) > c) && ((c + a) > b) && ((b + c) > a)) { (12) boolean = 1; (13) } (14) } (15) else { (16) boolean = -1; (17) } (18) if (boolean = = 1) { (19) if ((a = =b) && (b = =c)) { (20) printf ("Triangle is equilateral"); (21) } (22) else if ((a = =b) I I (b = = c) I I (c = = a)) {

16 (23) print ("Triangle is isosceles"); (24) } (25) else { (26) printf("Triangle is scalene”); (27) } (28) } (29) else if (boolean = = 0) { (30) printf ("Not a triangle"); (31) } (32) else (33) printf ("n invalid input range"); (34) } (35) getch ( ); (36) return -1; (37) }

17 Step – 2: Draw the following Flow Graph

18 Step – 3: Draw the following DD Path Graph
Since, nodes 1-9 are sequential nodes in the above flow graph, hence they are merged together as a single node – “a”. Likewise we can go on deciding the merging of nodes & arrive at the following DD Path Graph

19

20 Independent paths are:
ABCDEGHIMQR AABCEGHJKMQR ABCEGHJLMQR ABFGNOQR ABFGNPQR ABFGHIMQR ABFGHJKMQR ABFGHJLMQR

21 Conclusions from the above:
Conclusion – 1: Each of these paths consists of at least one new edge. Hence this basis set of paths is NOT unique.  Conclusion – 2: Test cases should be designed for the independent path execution as identified above. Conclusion – 3: We must execute these paths at least once in order to test the program thoroughly.

22 Consider the problem for the determination of the nature of roots of a quadratic equation. Draw the flow graph and DD path graph. Also find independent paths from the DD Path graph.

23

24 Flow Graph

25 DD Path graph

26 The mapping table for DD path graph is:

27

28 Thank You


Download ppt "SOFTWARE PRESENTATION ON Path Testing And Decision To Decision Path"

Similar presentations


Ads by Google