The byproduct of sericulture in different industries.pptx
Black box & white-box testing technique
1. Testing CompetencyTesting Competency 11
White Box & Black BoxWhite Box & Black Box
Testing TechniquesTesting Techniques
ManishManish
Roopa SRoopa S
2. Testing Competency 2
What does Test meanWhat does Test mean
The word “TEST” is derived from the LatinThe word “TEST” is derived from the Latin
word “Testum” meaning a pottery vesselword “Testum” meaning a pottery vessel
used to measure or assessused to measure or assess
3. Testing Competency 3
Software TestingSoftware Testing
Testing of software means assessing orTesting of software means assessing or
Measuring the software to determineMeasuring the software to determine
its QUALITYits QUALITY
Area of testing is one of the key processArea of testing is one of the key process
areas of project life cycle in ensuringareas of project life cycle in ensuring
the QUALITY of the softwarethe QUALITY of the software
4. Testing Competency 4
QUALITYQUALITY
What is Quality product ?What is Quality product ?
A quality product is one which is fit for use.A quality product is one which is fit for use.
A quality product is one which is producedA quality product is one which is produced
as per pre-defined specifications.as per pre-defined specifications.
6. Testing Competency 6
Levels of TestingLevels of Testing
Levels of TestingLevels of Testing Testing TechniquesTesting Techniques
Unit TestingUnit Testing Structural Testing
IntegrationIntegration Structural & Functional
SystemSystem Functional, Risk based
AcceptanceAcceptance Functional, Risk based
7. Testing Competency 7
Test Design MethodsTest Design Methods
Black-Box and White-Box are Test DesignBlack-Box and White-Box are Test Design
MethodsMethods
8. Testing Competency 8
Black-Box TestingBlack-Box Testing
Black Box Testing is testing technique havingBlack Box Testing is testing technique having
no knowledge of the internalno knowledge of the internal
functionality/structure of the systemfunctionality/structure of the system
Synonyms for Black-Box are Behavioral,Synonyms for Black-Box are Behavioral,
Functional, Opaque-Box, Closed-Box etc.Functional, Opaque-Box, Closed-Box etc.
9. Testing Competency 9
contd…contd…
Black-box Testing focuses on testing theBlack-box Testing focuses on testing the
function of the program or application against itsfunction of the program or application against its
specificationspecification
Determines whether combinations of inputs andDetermines whether combinations of inputs and
operations produce expected resultsoperations produce expected results
When black box testing is applied to softwareWhen black box testing is applied to software
engineering, the tester would only know theengineering, the tester would only know the
"legal" inputs and what the expected outputs"legal" inputs and what the expected outputs
should be, but not how the program actuallyshould be, but not how the program actually
arrives at those outputsarrives at those outputs
10. Testing Competency 10
Focus of Black-Box TestingFocus of Black-Box Testing
In this technique, we do not use the codeIn this technique, we do not use the code
to determine a test suite; rather, knowingto determine a test suite; rather, knowing
the problem that we're trying to solve, wethe problem that we're trying to solve, we
come up with four types of test data:come up with four types of test data:
Easy-to-compute dataEasy-to-compute data
Typical dataTypical data
Boundary / extreme dataBoundary / extreme data
Bogus dataBogus data
12. Testing Competency 12
Equivalence PartitioningEquivalence Partitioning
An equivalence class is a subset of dataAn equivalence class is a subset of data
that is representative of a larger classthat is representative of a larger class
Equivalence partitioning is a technique forEquivalence partitioning is a technique for
testing equivalence classes rather thantesting equivalence classes rather than
undertaking exhaustive testing of eachundertaking exhaustive testing of each
value of the larger classvalue of the larger class
13. Testing Competency 13
Example - EPExample - EP
For example, a program which edits creditFor example, a program which edits credit
limits within a given range ($10,000 -limits within a given range ($10,000 -
$15,000) would have three equivalence$15,000) would have three equivalence
classesclasses
< $10,000 (invalid)< $10,000 (invalid)
Between $10,000 and $15,000 (valid)Between $10,000 and $15,000 (valid)
> $15,000 (invalid)> $15,000 (invalid)
14. Testing Competency 14
Boundary AnalysisBoundary Analysis
This technique consists of developing testThis technique consists of developing test
cases and data that focus on the input andcases and data that focus on the input and
output boundaries of a given functionoutput boundaries of a given function
15. Testing Competency 15
Example – Boundary AnalysisExample – Boundary Analysis
In the same credit limit example, boundaryIn the same credit limit example, boundary
analysis would test.analysis would test.
Low boundary -/+ one ($9,999 and $10,001)Low boundary -/+ one ($9,999 and $10,001)
On the boundary ($10,000 and $15,000)On the boundary ($10,000 and $15,000)
Upper boundary -/+ one ($14,999 andUpper boundary -/+ one ($14,999 and
$15,001)$15,001)
16. Testing Competency 16
Error GuessingError Guessing
Test cases can be developed based uponTest cases can be developed based upon
the intuition and experience of the testerthe intuition and experience of the tester
For example, where one of the inputs isFor example, where one of the inputs is
the date, a tester may try February 29,the date, a tester may try February 29,
20012001
17. Testing Competency 17
Cause-Effect GraphingCause-Effect Graphing
Cause-effect graphing is a technique forCause-effect graphing is a technique for
developing test cases for programs fromdeveloping test cases for programs from
the high-level specifications (A high-levelthe high-level specifications (A high-level
specification states desired characteristicsspecification states desired characteristics
of the system)of the system)
These characteristics can be used toThese characteristics can be used to
derive test dataderive test data
18. Testing Competency 18
Example – Cause EffectExample – Cause Effect
For example, a program that has specifiedFor example, a program that has specified
responses to eight characteristic stimuli (calledresponses to eight characteristic stimuli (called
causes) given some input has 256 "types" ofcauses) given some input has 256 "types" of
input (i.e., those with characteristics 1 & 3; 5, 7input (i.e., those with characteristics 1 & 3; 5, 7
& 8 etc.)& 8 etc.)
A poor approach is to generate 256 test casesA poor approach is to generate 256 test cases
A more methodical approach is to use theA more methodical approach is to use the
program specifications to analyze the program'sprogram specifications to analyze the program's
effect on the various types of inputseffect on the various types of inputs
19. Testing Competency 19
contd…contd…
The program's output domain can be partitionedThe program's output domain can be partitioned
into various classes called effectsinto various classes called effects
For example, inputs with characteristic 2 mightFor example, inputs with characteristic 2 might
be subsumed by those with characteristics 3 &be subsumed by those with characteristics 3 &
4. Hence, it would not be necessary to test4. Hence, it would not be necessary to test
inputs with characteristic 2 and characteristics 3inputs with characteristic 2 and characteristics 3
& 4, for they cause the same effect& 4, for they cause the same effect
This analysis results in a partitioning of theThis analysis results in a partitioning of the
causes according to their corresponding effectscauses according to their corresponding effects
20. Testing Competency 20
contd…contd…
A limited entry decision table is then constructedA limited entry decision table is then constructed
from the directed graph reflecting thesefrom the directed graph reflecting these
dependencies (i.e., causes 2 & 3 result in effectdependencies (i.e., causes 2 & 3 result in effect
4; causes 2, 3 & 5 result in effect 6 etc.)4; causes 2, 3 & 5 result in effect 6 etc.)
The decision table is then reduced and testThe decision table is then reduced and test
cases chosen to exercise each column of thecases chosen to exercise each column of the
tabletable
Since many aspects of the cause-effect graphingSince many aspects of the cause-effect graphing
can be automated, it is an attractive tool forcan be automated, it is an attractive tool for
aiding in the generation of Functional Test casesaiding in the generation of Functional Test cases
21. Testing Competency 21
Advantages of Black-BoxAdvantages of Black-Box
TestingTesting
More effective on larger units of code thanMore effective on larger units of code than
glass box testingglass box testing
Tester needs no knowledge ofTester needs no knowledge of
implementation, including specificimplementation, including specific
programming languagesprogramming languages
Tester and programmer are independentTester and programmer are independent
of each otherof each other
22. Testing Competency 22
Advantages of Black-BoxAdvantages of Black-Box
Testing Contd…Testing Contd…
Tests are done from a user's point of viewTests are done from a user's point of view
Will help to expose any ambiguities orWill help to expose any ambiguities or
inconsistencies in the specificationsinconsistencies in the specifications
Test cases can be designed as soon asTest cases can be designed as soon as
the specifications are completethe specifications are complete
23. Testing Competency 23
Disadvantages of Black-BoxDisadvantages of Black-Box
TestingTesting
Only a small number of possible inputs canOnly a small number of possible inputs can
actually be tested, to test every possible inputactually be tested, to test every possible input
stream would take nearly foreverstream would take nearly forever
Without clear and concise specifications, testWithout clear and concise specifications, test
cases are hard to designcases are hard to design
There may be unnecessary repetition of testThere may be unnecessary repetition of test
inputs if the tester is not informed of test casesinputs if the tester is not informed of test cases
the programmer has already triedthe programmer has already tried
24. Testing Competency 24
Disadvantages of Black-Box TestingDisadvantages of Black-Box Testing
Contd…Contd…
May leave many program paths untestedMay leave many program paths untested
Cannot be directed toward specificCannot be directed toward specific
segments of code which may be verysegments of code which may be very
complex (and therefore more error prone)complex (and therefore more error prone)
25. Testing Competency 25
White-Box TestingWhite-Box Testing
White-box test design allows one to peekWhite-box test design allows one to peek
inside the "box“inside the "box“
Synonyms for White-box are Structural,Synonyms for White-box are Structural,
Glass-box and Clear-boxGlass-box and Clear-box
26. Testing Competency 26
cont…cont…
White-box Testing assumes that the pathWhite-box Testing assumes that the path
of logic in a unit or program is knownof logic in a unit or program is known
White-box Testing consists of testingWhite-box Testing consists of testing
paths, branch by branch, to producepaths, branch by branch, to produce
predictable resultspredictable results
Focuses specifically on using internalFocuses specifically on using internal
knowledge of the software to guide theknowledge of the software to guide the
selection of test dataselection of test data
27. Testing Competency 27
White-Box TestingWhite-Box Testing
TechniquesTechniques
Statement CoverageStatement Coverage
execute all statements at least onceexecute all statements at least once
Decision CoverageDecision Coverage
execute each decision direction at least onceexecute each decision direction at least once
Condition CoverageCondition Coverage
execute each decision with all possibleexecute each decision with all possible
outcomes at least onceoutcomes at least once
28. Testing Competency 28
cont…cont…
Decision/Condition CoverageDecision/Condition Coverage
execute all possible combinations of conditionexecute all possible combinations of condition
outcomes in each decisionoutcomes in each decision
Multiple Condition CoverageMultiple Condition Coverage
invoke each point of entry at least onceinvoke each point of entry at least once
Choose the combinations of techniquesChoose the combinations of techniques
appropriate for the applicationappropriate for the application
29. Testing Competency 29
Statement CoverageStatement Coverage
Necessary but not sufficient, doesn’t address allNecessary but not sufficient, doesn’t address all
outcomes of decisionsoutcomes of decisions
For exampleFor example
…………..
Begin()Begin()
If (function1())If (function1())
OpenFile1()OpenFile1()
ElseElse
Shutdown();Shutdown();
………………
Here if the first IF statement is true thenHere if the first IF statement is true then
Shutdown will never occurShutdown will never occur
30. Testing Competency 30
Decision CoverageDecision Coverage
Validates the Branch Statements in softwareValidates the Branch Statements in software
Overcomes the drawbacks of statementOvercomes the drawbacks of statement
coveragecoverage
Each decision is tested for a TrueEach decision is tested for a True && FalseFalse
valuevalue
Each branch direction must be traversed atEach branch direction must be traversed at
least onceleast once
Branches like if…else, while, for do...whileBranches like if…else, while, for do...while
are to be evaluated for both true and falseare to be evaluated for both true and false
Test cases will be arrived with the help of aTest cases will be arrived with the help of a
Decision tableDecision table
31. Testing Competency 31
Cont…Cont…
Decision TableDecision Table
• Table which helps to derive the test casesTable which helps to derive the test cases
StepsSteps
• Identify the variables which are responsible forIdentify the variables which are responsible for
decisiondecision
• Identify the total number of decisions (GiveIdentify the total number of decisions (Give
numbers to them like IF1, IF2… While1, While2numbers to them like IF1, IF2… While1, While2
etc)etc)
• Put thePut the variablesvariables as rows andas rows and decisionsdecisions asas
verticalsverticals
• Start to map the values for each variablesStart to map the values for each variables
corresponding to each decisionscorresponding to each decisions
32. Testing Competency 32
An ExampleAn Example
Procedure liability (age, sex, married, premium);Procedure liability (age, sex, married, premium);
beginbegin
premium=500;premium=500;
If ((age<25) and (sex=male) and (not married))If ((age<25) and (sex=male) and (not married)) IF-1IF-1
thenthen
premium=Premium+1500;premium=Premium+1500;
elseelse
(if (married or (sex=female))(if (married or (sex=female)) IF-2IF-2
thenthen
premium=premium-200;premium=premium-200;
If( (age>45) and (age<65))If( (age>45) and (age<65)) IF-3IF-3
thenthen
premium= premium-100;premium= premium-100;
end;end;
Here variables areHere variables are age, sexage, sex andand marriedmarried
Decisions are IF1; IF2 ; IF3Decisions are IF1; IF2 ; IF3
33. Testing Competency 33
DecisionDecision
CoverageCoverage
AgeAge SexSex MarriedMarried TestTest
casecase
IF-1IF-1 <25<25 MaleMale FalseFalse (1) 23 M F(1) 23 M F
IF-1IF-1 <25<25 FemaleFemale FalseFalse (2) 23 F F(2) 23 F F
IF-2IF-2 ** FemaleFemale ** (2)(2)
IF-2IF-2 >=25>=25 MaleMale FalseFalse (3) 50 M F(3) 50 M F
IF-3IF-3 <=45<=45 FemaleFemale ** (2)(2)
IF-3IF-3 >45>45
<65<65
** ** (3)(3)
Decision TableDecision Table
34. Testing Competency 34
Condition CoverageCondition Coverage
Validates logical relations and conditionsValidates logical relations and conditions
All the conditions should be executed at leastAll the conditions should be executed at least
once for the both false and trueonce for the both false and true
Conditions using relational and logical operatorsConditions using relational and logical operators
should be checked for all possible outcomesshould be checked for all possible outcomes
Condition coverage checks for true and falseCondition coverage checks for true and false
outcome of each Boolean sub expressionoutcome of each Boolean sub expression
Test cases will be arrived from using sameTest cases will be arrived from using same
Decision table by putting conditions in place ofDecision table by putting conditions in place of
decisionsdecisions
35. Testing Competency 35
Test conditionsTest conditions
ConditionCondition
CoverageCoverage
AgeAge SexSex MarriedMarried Test CaseTest Case
IF-1IF-1 <25<25 FemaleFemale FalseFalse (1) 23 F F(1) 23 F F
IF-1IF-1 >=25>=25 MaleMale TrueTrue (2) 30 M T(2) 30 M T
IF-2IF-2 ** MaleMale TrueTrue (2)(2)
IF-2IF-2 ** FemaleFemale FalseFalse (1)(1)
IF-3IF-3 <=45<=45 ** ** (1)(1)
IF-3IF-3 >45>45 ** ** (3) 70 F F(3) 70 F F
IF-3IF-3 <65<65 ** ** (2)(2)
IF-3IF-3 >=65>=65 ** ** (3)(3)
36. Testing Competency 36
Condition/Decision Coverage
We may not always get result either in
decision coverage or condition coverage.
In such cases, go in for decision &
condition coverage
Test cases will be arrived form both
decision as well as condition coverage
37. Testing Competency 37
Condition/Decision Test caseCondition/Decision Test case
Decision/condition coverageDecision/condition coverage AgeAge SexSex MarriedMarried Test CaseTest Case
IF-1(decision)IF-1(decision) <25<25 MaleMale FalseFalse (1) 23 M F(1) 23 M F
IF-1(decision)IF-1(decision) <25<25 FemaleFemale FalseFalse (2) 23 F F(2) 23 F F
IF-1(condition)IF-1(condition) <25<25 FemaleFemale FalseFalse (2)(2)
IF-1(condition)IF-1(condition) >=25>=25 MaleMale TrueTrue (3) 70 M T(3) 70 M T
IF-2(decision)IF-2(decision) ** FemaleFemale ** (2)(2)
IF-2(decision)IF-2(decision) >=25>=25 MaleMale FalseFalse (4) 50 M F(4) 50 M F
IF-2(condition)IF-2(condition) ** MaleMale TrueTrue (3)(3)
IF-2(condition)IF-2(condition) ** FemaleFemale FalseFalse (2)(2)
IF-3(decision)IF-3(decision) <=45<=45 ** ** (2)(2)
IF-3(decision)IF-3(decision) >45, <65>45, <65 ** ** (4)(4)
IF-3(condition)IF-3(condition) <=45<=45 ** ** (2)(2)
IF-3(condition)IF-3(condition) >45>45 ** ** (4)(4)
IF-3(condition)IF-3(condition) <65<65 ** ** (4)(4)
IF-3(condition)IF-3(condition) >=65>=65 ** ** (3)(3)
38. Testing Competency 38
Multiple ConditionMultiple Condition
CoverageCoverage
Checks whether every possible combination ofChecks whether every possible combination of
Boolean sub expression occurs at least onceBoolean sub expression occurs at least once
(2n), where “n” is the number of variables in a(2n), where “n” is the number of variables in a
given branchgiven branch
Test cases required for this method can beTest cases required for this method can be
arrived at by using truth table of the conditionsarrived at by using truth table of the conditions
Large number of test cases may be required forLarge number of test cases may be required for
full multiple condition coveragefull multiple condition coverage
39. Testing Competency 39
Multiple Conditions Coverage –
Test cases
Multiple condition coverageMultiple condition coverage AgeAge SexSex MarriedMarried Test CaseTest Case
IF-1IF-1 <25<25 MaleMale TrueTrue (1) 23 M T(1) 23 M T
IF-1IF-1 <25<25 MaleMale FalseFalse (2) 23 M F(2) 23 M F
IF-1IF-1 <25<25 FemaleFemale TrueTrue (3) 23 F T(3) 23 F T
IF-1IF-1 <25<25 FemaleFemale FalseFalse (4) 23 F F(4) 23 F F
IF-1IF-1 >=25>=25 MaleMale TrueTrue (5) 30 M T(5) 30 M T
IF-1IF-1 >=25>=25 MaleMale FalseFalse (6) 70 M F(6) 70 M F
IF-1IF-1 >=25>=25 FemaleFemale TrueTrue (7) 50 F T(7) 50 F T
IF-1IF-1 >=25>=25 FemaleFemale FalseFalse (8) 30 F F(8) 30 F F
IF-2IF-2 ** MaleMale TrueTrue (5)(5)
IF-2IF-2 ** MaleMale FalseFalse (6)(6)
IF-2IF-2 ** FemaleFemale TrueTrue (7)(7)
IF-2IF-2 ** FemaleFemale FalseFalse (8)(8)
IF-3IF-3 <=45, >=65<=45, >=65 ** ** ImpossibleImpossible
IF-3IF-3 <=45,<65<=45,<65 ** ** (8)(8)
IF-3IF-3 >45, >=65>45, >=65 ** ** (6)(6)
IF-3IF-3 >45, <65>45, <65 ** ** (7)(7)
40. Testing Competency 40
Gray-Box TestingGray-Box Testing
: An Introduction: An Introduction
Blending of Structural and FunctionalBlending of Structural and Functional
Testing methods throughout the entireTesting methods throughout the entire
testing proceduretesting procedure
Examines the activity of back-endExamines the activity of back-end
components during test case executioncomponents during test case execution