Sanjivani College of Engineering, Kopargaon
Department of Electronics & Telecommunication Engineering
(An Autonomous Institute)
Affiliated to Savitribai Phule Pune University
Accredited ‘A’ Grade by NAAC
________________________________________________________________________________________
Subject: Software teSting &Quality aSSurance (EC319 )
UNIT 3:White Box Testing
Topic: Introduction
Prof. N. D. Kapale
Department of E& C Engineering 1
CONTENTS
Introduction, Need of white box testing,
Testing types,
Static testing by humans,
Structural Testing – Control flow testing, Loop Testing,
Design of test cases,
Challenges in White box testing,
Case-studies of White-Box testing.
Prof. N. D. Kapale Department of E& C Engineering
Black box Testing
• Software considered as black box
• Test data derived from the specification
• No knowledge of code or internal structure of software
necessary
• Known as data driven or Input/output driven testing
• Also known as functional testing
• Test cases are designed using only function specification of
the software
• The goal is to achieve the throuhness of exhaustive input
testing, with much less effort
Prof. N. D. Kapale Department of E& C Engineering
White box Testing
•To design test cases
•Knowledge of internal structure of software
necessary
•Also called structural testing
Prof. N. D. Kapale Department of E& C Engineering
White box Testing
Need to do both the testing
Prof. N. D. Kapale Department of E& C Engineering
White box Testing
statement,Condition,decisions,paths control flow
arithmetic operators,variable type,logical expression
Prof. N. D. Kapale Department of E& C Engineering
White box Testing
Each statement executed at least once
Each branch traverse
at least once
Each condition true at least once and false at
least once
Multiple Condition: All combination of condition covered
Prof. N. D. Kapale Department of E& C Engineering
White box Testing
if you are doing a stronger testing, weaker testing is not necessary.
Prof. N. D. Kapale Department of E& C Engineering
If 2 test strategies are complementary, then we need to conduct testing using both
strategies
need to do testing with both these blue and green strategies; we only can eliminate
the weaker strategy.
number of branches will be 2*n.
if (C)
a=b
c is true, then we achieve the statement coverage, but it
does not achieve branch coverage because c is false has not
been ensured.
branch coverage does not ensure statement coverage
Basic Condition Coverage
Prof. N. D. Kapale Department of E& C Engineering
Basic Condition Coverage
Prof. N. D. Kapale Department of E& C Engineering
• Assume failure occurs at C=DIGIT
• Branch/Decision Condition Satisfied with C=ALPHABET ,C=SPLCHAR
• The faulty Subexpression might not be tested
• Eventhough both outcome of branch tested
Basic Condition Coverage
((a=10 ll b>5)&& c<100)
There are 3 automic /basic conditions, outcomes for =4/6=2/3
3 conditions is 2*3=6
Designed a test case
test case 1
a=10, b=3, c=500 which made this true, false, false and also true value for
the second condition
test case2
a=10,b=10,c=200 which made this true, true, false.
Prof. N. D. Kapale Department of E& C Engineering
Basic Condition Coverage
• Cannot say that basic condition coverage is a stronger
form of testing than decision testing.
• We could achieve the decision coverage, but that did
not achieve the basic condition coverage.
• The basic condition coverage and decision
coverage are complimentary,
• one cannot really is stronger than the other testing.
Prof. N. D. Kapale Department of E& C Engineering
Condition/Decision Coverage
Prof. N. D. Kapale Department of E& C Engineering
Multiple Condition Coverage(MCC)
Prof. N. D. Kapale Department of E& C Engineering
MCC
Prof. N. D. Kapale Department of E& C Engineering
Short Circuit Evaluation
Prof. N. D. Kapale Department of E& C Engineering
MCC- Short Circuit Evaluation
Prof. N. D. Kapale Department of E& C Engineering
Modified Condition/Decision Coverage(MC/DC)
Prof. N. D. Kapale Department of E& C Engineering
MC/DC
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Prof. N. D. Kapale Department of E& C Engineering
Example • Mutant Program
If(x<y)
• Original Program
Print “Hello”
If (x>y) Else
Print “Hello” Print “Hi”
Else
Print “Hi”
If(x==y)
We can replace == into >= and
If(x>y) replace x and y values have mutant program as
If(x>=y) and inserting ++ in the
If(5>y) replace x by constant 5 statement
If(x==++y)
Equivalent Mutants
• There may be surviving mutants that cannot be killed,
• These are called Equivalent Mutants Although syntactically
different:
• These mutants are indistinguishable through testing.
• Therefore have to be checked ‘by hand’
while... while...
... ...
i++ i++
if (i==5) if (i>=5)
break; break;
Disadvantages of Mutation Testing
• Equivalent mutants
• Computationally very expensive.
• A large number of possible mutants can be generated.
• Certain types of faults are very difficult to inject.
• Only simple syntactic faults introduced
Challenges in white box testing
• Lack of Understanding Of Programming Language(S)
Used For Testing:
Most of tester do not know what is happening behind the scene
when they are trying to test a website or an application.
The majority of them are only bothered to do the testing to
prove whether it works for them or not.
• Lack Of Understanding The Logical Flow/Use Case :
Even if the tester understands how the program works or what
is happening behind the scene, they may not be able to
understand the logical flow of the program.
• Lack Of Patience To Go Thorough The Program:
The majority of testers feel that they should test all the modules in a
couple of hours to take out time for other things.
• The Reality Of Testing:
software testing services are something no one can be assured of
getting right.
There is always a chance that the program may not work as we expect
it to work.
• Copying The Existing Functionality:
many software testers copying the existing functionalities in the
program;
they add a few more things when they think some functionality is
missing. This is because they want to satisfy their managers.
• Allowing Clients/Managers To Influence:
Most of tester do not like it when we are influenced by
clients/managers.
The majority of the testers give up their views and accept what clients
or managers say. They want to maintain good relations with them so
that their job will not be jeopardized.
• Lack Of Patience:
• Not Being Honest Enough With The Client:
Most testers are always afraid to speak out their minds while White
Box Testing an application or a website for clients/customers because
they might lose their job if it goes wrong.
Instead, they want to keep the client happy by showing them something
is not happening.
• Spending Long Hours In Testing:
many testers feel that they should spend long hours in
testing because it will help them be more accurate.
However, most of the time, testers want to avoid doing
testing and spend time surfing on the internet.
• Stress:
software testers usually suffer from stress in their life when
they see something is going wrong in the application or the
website.
Thank You!
Prof. N. D. Kapale Department of E&Tc Engineering
82