İstanbul evden eve nakliyat Beylikd¨Ήz¨Ή evden eve nakliyat Tuzla evden eve nakliyat
Tutorial-2 Basis Path Testing-Estimation of Complexity Measure V-G
Delicious Bookmark this on Delicious
software testing genius

Tutorial-2 Basis Path Testing-Estimation of Complexity Measure V-G

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

Tutorial-2: Basis Path Testing-Estimation of Complexity Measure V(G)

Basis path testing helps a tester to compute logical complexity measure, V(G), of the code. This value of V(G), defines the maximum number of test cases to be designed by identifying basis set of execution paths to ensure that all statements are executed at least once.

Steps to compute the complexity measure, V(G) are as under

Step – 1: Construct the flow graph from the source code or flow charts.

Refer Following Tutorial on :

face="Verdana, Arial, Helvetica, sans-serif" color=#0000ff size=3>Flow Graph and its Notations

Step – 2:  Identify independent paths.


Step – 3:
Calculate Cyclomatic Complexity, V(G).

Step – 4: Design the test cases.

 

Objective of the Tutorial: To draw a Flow Graph, find its Cyclomatic Complexity, V(G) and the independent paths for the following piece of code.

void foo (float y, float a *, int n)

 

{

float x = sin (y) ;

if (x > 0.01)


z = tan (x) ;

else

z = cos (x) ;

for (int i = 0 ; i < x ; + + i) {


a[i] = a[i] * z ;

Cout < < a [i] ;


}

 

Step – 1: Let us try to provide numbering to the various nodes as per the following Flow Graph



Step – 2: Piece of code being covered under Node –1

void foo (float y, float a *, int n)

 

{

float x = sin (y) ;

if (x > 0.01)

 

Step – 3: Piece of code being covered under Node –2

z = tan (x) ;

else

 

Step – 4: Piece of code being covered under Node –3

z = cos (x) ;

 

Step – 5: Piece of code being covered under Node –4

for (int i = 0 ; i < x ; + + i)

 

Step – 6: Piece of code being covered under Node –5

{


Step – 7:
Piece of code being covered under Node –6

a[i] = a[i] * z ;

Cout < < a [i] ;


}

 

Step – 8: Piece of code being covered under Node –7

Cout < < a [i] ;


}

Step – 9: Calculation of V(G) by three methods

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

V(G) = 8 – 7 + 2=3

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

V(G) = 2 + 1 = 3                (Nodes 1 and 5 are predicate nodes)


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

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


Conclusions from the above tutorial:

Conclusion – 1: By getting a value of V(G) = 3 we conclude that it is a “well written” code, its “testability” is high and cost / effort to maintain is low.

Conclusion – 2:
There are 3 paths in this program which are independent paths and they form a basis-set. These paths are described below


Path 1:

1 – 2 – 4 – 5 - 7

Path 2:

1 – 3 – 4 – 5 - 7

Path 3:

1 – 3 – 4 – 5 – 6 - 7


Conclusion – 3: We can form another basis-set as described below

Path 1:

1 – 2 – 4 – 5 - 7

Path 2:

1 – 3 – 4 – 5 - 7

Path 3:

1 – 2 – 4 – 5 – 6 - 7

Conclusion – 4: We must execute these paths at least once in order to test the program thoroughly. Accordingly we can design the test cases.


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