GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Testing  >  Software Testing
Go To First  |  Previous Question  |  Next Question 
 Software Testing  |  Question 236 of 266    Print  
Statement and decision coverage
Consider the following:
Pick up and read the newspaper
Look at what is on television
If there is a program that you are interested in watching then switch the television on and watch the program
Otherwise
Continue reading the newspaper
If there is a crossword in the newspaper then try and complete the crossword

a) SC = 1 and DC = 1
b) SC = 1 and DC = 2
c) SC = 1 and DC = 3
d) SC = 2 and DC = 2
e) SC = 2 and DC = 3

SC=Statement coverage DC=Decision coverage



  
Total Answers and Comments: 3 Last Update: February 12, 2009     Asked by: RM32306 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Cryptic_sumon
 
Statement Coverage is a traditional terget. Its deifne the coverage terget in Control flow Graph and write test cases to achive it. For example, Supose that we write and execute two test cases.

if 5=true than go to 6
//else if 5=false than go to 7

Test1: Follow paths 1-2-Exit
Test2: Follow paths 1-2-3-4-5-6-8-2-3-4-5-6-8-2-Exit.
here we can see in the test 2, we execute 2 loops and both time takes the true braches. and skips the false braches. so node number 6 is not executed so its not 100% statement coverrage


Otherhand The decision coverage is predicate nodes which always check condition for branching.  As an example we can use "if and else" "do while" and "switch " etc to coverage conditional branching to achive we need to write tests cases and execute it. 

Above answer was rated as good by the following members:
hirenmistry, sharmiprakash
February 19, 2008 03:57:23   #1  
Cryptic_sumon Member Since: February 2008   Contribution: 3    

RE: Statement and decision coverage
Statement Coverage is a traditional terget. Its deifne the coverage terget in Control flow Graph and write test cases to achive it. For example Supose that we write and execute two test cases.

if 5 true than go to 6
//else if 5 false than go to 7

Test1: Follow paths 1-2-Exit
Test2: Follow paths 1-2-3-4-5-6-8-2-3-4-5-6-8-2-Exit.
here we can see in the test 2 we execute 2 loops and both time takes the true braches. and skips the false braches. so node number 6 is not executed so its not 100 statement coverrage


Otherhand The decision coverage is predicate nodes which always check condition for branching. As an example we can use "if and else" "do while" and "switch " etc to coverage conditional branching to achive we need to write tests cases and execute it.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
June 18, 2008 08:54:00   #2  
nasa_dead Member Since: June 2008   Contribution: 1    

RE: Statement and decision coverage
sc 2 dc2
 
Is this answer useful? Yes | No
February 12, 2009 04:34:50   #3  
dmplakhan Member Since: February 2009   Contribution: 1    

RE: Statement and decision coverage
sc 2 and dc 3
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape