Coverage-Based testing 
CONSIDERING THE OBJECTS OF TESTING TO COVERING FUNCTIONAL OR 
EXECUTION UNITS
Testing techniques 
Black Box 
 (Specification-based techniques) 
Examines the functionality of an 
application without peering into its 
internal structures or workings. 
 This method of test can be applied to 
virtually every level of software testing: 
unit, integration, system and acceptance. 
White Box 
 (Structure-based techniques) Tests 
internal structures or workings of an 
application. An internal perspective of 
the system, as well as programming 
skills, are used to design test cases. 
 White-box testing can be applied at the 
unit, integration and system levels of the 
software testing process.
Perspective 
 It is often used in early sub-stages of software testing. 
 Bugs are more closely related to objects under test, leading to effectual 
software bug removal. 
 Uses coverage purposes as the stop criteria.
Pros & Cons 
Advantages 
 Conducted by either professional testers 
or by developers themselves 
 Testing models are often created 
without active client or user input 
 It helps in determining a quantitative 
measure of code coverage, which 
indirectly measure the quality of the 
application or product. 
Disadvantages 
 The efficiency reduces with large objects 
(big projects). 
 If a specified function has not been 
implemented or a function was omitted 
from the specification, then structure-based 
techniques cannot say anything 
about them it only looks at a structure 
which is already there. 
 100% coverage does not mean 100% 
tested.
Coverage Criteria 
Types 
NOT ALL OF THEM, ONLY THE 
MOST COMMON
Statement Coverage 
 The test case is executed in such a way 
that every statement of the code is 
executed at least once.
Branch coverage 
 It requires enough test cases such that 
each condition in a decision takes on all 
possible outcomes at least once, and 
each point of entry to a program or 
subroutine is invoked at least once.
Condition coverage 
 It ensures that every possible condition 
is executed at least once.
Path coverage 
 Path Coverage ensures covering of all 
the paths from start to end.
Practice 
 public int returnInput (int input, boolean 
condition1, boolean condition2, boolean 
condition3) { 
int x = input; 
int y = 0; 
if (condition1) 
x++; 
if (condition2) 
x--; 
if (condition3) 
y=x; 
return y; 
} 
 Please estimate the number of test cases 
required for 100% code covered for: 
 Statement Coverage 
 Branch Coverage 
 Path Coverage
Memorize this… 
100% Path coverage will imply 100% 
Statement coverage 
100% Branch coverage will imply 100% 
Statement coverage 
100% Path coverage will imply 100% Branch 
coverage
References 
 http://www.softwaretestingtimes.com/2010/04/white-box-testing-simplified. 
html 
 http://en.wikipedia.org/ 
 http://sce.uhcl.edu/helm/VAV_SENG_WEB/My-Files/Unit6/Unit6P2.htm

ScioTalks | Coverage Based Testing

  • 1.
    Coverage-Based testing CONSIDERINGTHE OBJECTS OF TESTING TO COVERING FUNCTIONAL OR EXECUTION UNITS
  • 2.
    Testing techniques BlackBox  (Specification-based techniques) Examines the functionality of an application without peering into its internal structures or workings.  This method of test can be applied to virtually every level of software testing: unit, integration, system and acceptance. White Box  (Structure-based techniques) Tests internal structures or workings of an application. An internal perspective of the system, as well as programming skills, are used to design test cases.  White-box testing can be applied at the unit, integration and system levels of the software testing process.
  • 3.
    Perspective  Itis often used in early sub-stages of software testing.  Bugs are more closely related to objects under test, leading to effectual software bug removal.  Uses coverage purposes as the stop criteria.
  • 4.
    Pros & Cons Advantages  Conducted by either professional testers or by developers themselves  Testing models are often created without active client or user input  It helps in determining a quantitative measure of code coverage, which indirectly measure the quality of the application or product. Disadvantages  The efficiency reduces with large objects (big projects).  If a specified function has not been implemented or a function was omitted from the specification, then structure-based techniques cannot say anything about them it only looks at a structure which is already there.  100% coverage does not mean 100% tested.
  • 5.
    Coverage Criteria Types NOT ALL OF THEM, ONLY THE MOST COMMON
  • 6.
    Statement Coverage The test case is executed in such a way that every statement of the code is executed at least once.
  • 7.
    Branch coverage It requires enough test cases such that each condition in a decision takes on all possible outcomes at least once, and each point of entry to a program or subroutine is invoked at least once.
  • 8.
    Condition coverage It ensures that every possible condition is executed at least once.
  • 9.
    Path coverage Path Coverage ensures covering of all the paths from start to end.
  • 10.
    Practice  publicint returnInput (int input, boolean condition1, boolean condition2, boolean condition3) { int x = input; int y = 0; if (condition1) x++; if (condition2) x--; if (condition3) y=x; return y; }  Please estimate the number of test cases required for 100% code covered for:  Statement Coverage  Branch Coverage  Path Coverage
  • 11.
    Memorize this… 100%Path coverage will imply 100% Statement coverage 100% Branch coverage will imply 100% Statement coverage 100% Path coverage will imply 100% Branch coverage
  • 12.
    References  http://www.softwaretestingtimes.com/2010/04/white-box-testing-simplified. html  http://en.wikipedia.org/  http://sce.uhcl.edu/helm/VAV_SENG_WEB/My-Files/Unit6/Unit6P2.htm