İstanbul evden eve nakliyat Beylikd¨¹z¨¹ evden eve nakliyat Tuzla evden eve nakliyat
Tutorial-7 DD Path Testing-Case of a Triangle
Delicious Bookmark this on Delicious
software testing genius

Tutorial-7 DD Path Testing-Case of a Triangle

Welcome to “Software Testing Genius”. Subscribe to my RSS feed for latest content on Software Testing.

Tutorial-7: DD Path Testing: Case of a Triangle

Objective of the Tutorial:
To draw a Flow Graph, a DD Graph, calculation of Cyclomatic Complexity V(G) and find out all independent paths from the DD paths graph, for the case of a triangle wherein the program reads the three sides of a triangle (say a, b, c). The output may be Scalene triangle or a Isosceles triangle or an equilateral triangle or might not be a triangle at all.

 

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.

style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; mso-bidi-font-family: 'Times New Roman'; mso-themecolor: text1"> 

 

Process of constructing the DD Graph leading to computation of Cyclomatic Complexity goes like this:

 

Step – 1: Start writing the following C - program

 

# include

 

# 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);

 

(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)) {

 

(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) }

 

Step – 2: Draw the following Flow Graph

 
 

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

 

 

We get following decision table.

 

 

Step – 4: Calculation of Cyclomatic Complexity V(G) by three methods

 

Method – 1: V(G) = e – n + 2 ( Where “e” are  edges & “n” are nodes)

V(G) = 23– 18+ 2 = 5 + 2 = 7

 

Method – 2: V(G) = P + 1 (Where P – No. of predicate nodes with out degree = 2)


V(G) = 6 + 1 = 7   (Nodes b, c, g, h, j & n are predicate nodes with 2 outgoing edges)

 

Method – 3: V(G) = Number of enclosed regions + 1 = 6+1=7

( Here R1, R2, R3, R4, R5 & R6 are the enclosed regions and 1 corresponds to one outer region)

 

V(G) = 7 and is same by all the three methods.

 

 

Step – 5: Identification of the basis-set with Seven Paths

 

 

Conclusions from the above tutorial:

 

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.

Many more Articles & Tutorials on White Box Testing

Largest Database of Sample Papers - 1000+ Unique Questions for ISTQB Foundation Exam

ISTQB Foundation Exam - Full Crash Course for Download

ISTQB Advanced CTAL Test Analysts Exam - Full Crash Course for Download


ISTQB Advanced CTAL Test Manager Exam - Full Crash Course for Download


What Successful Testers say about the Quality of this website

If you want to keep track of further articles on Software Testing,
I suggest you to subscribe my
RSS feed
.

You can also Subscribe by E-mail
and get All New articles delivered directly to your Inbox.

Get your Absolutely Free Copy of Several MS PowerPoint Presentations & E-Books related to ISTQB, HP Load Runner, IBM RFT, HP QTP & QC Certification Exams, prepared by Popular Writers & Trainers, by writing to: Software.testing.genius@gmail.com

Full Study Material for Popular Certification Exams:

Study Material - HP QTP & QC Certification Exam

Study Material - IBM RFT Certification Exam

Study Material - HP LoadRunner Certification Exams for All Modules

Study Material - ISTQB Certification Exam

Most Popular Topics in Demand:

Practical Roadmap to QTP Certification

Practical Roadmap to CSTE Certification

Consolidated Study Material - Testing & QA

Rehearsal of QTP in 1 Hr. -  Interview Questions

 

Comments :

comments ↓


Leave Your Comments: (*) Marked Fields are Mandatory

You can apply basic formatting to the text

Name *
 
Email Address *
 
Website
 
Speak your mind
characters
sex hikayeleri