Software Testing Introduction
Software Testing Introduction
Dr Atul Gupta
DrAtulGupta
Defect/fault/bug:Manifestationofanerrorin
a program
aprogram.
Example:
Incorrectcode:
Correct code
Correctcode:
if(a<b){foo(a,b);}
if(a>b){foo(a,b);}
if
(a>b) {foo(a b) }
Failure:
Failure:Manifestationofoneormorefaults
Manifestation of one or more faults in
in
theobservedprogrambehavior
Failure
Incorrect
Incorrectprogrambehaviorduetoafaultin
program behavior due to a fault in
theprogram.
Failurecanbedeterminedonlywithrespectto
Failure can be determined only with respect to
asetofrequirementspecifications.
Anecessary
A necessary conditionforafailuretooccuris
condition for a failure to occur is
thatexecutionoftheprogramforcethe
erroneous portion of the program to be
erroneousportionoftheprogramtobe
executed.
Sufficient condition?
T ti P bl
TestingProblem
Error-revealing
inputs cause
failure
I
Inputs
t
Program
Outputs
Erroneous
outputs indicate
failure
Acceptance
Testing
SRS
Tested Software
System Design
System Testing
System Design
Subsystem
Detailed Design
g
Integration
g
Testing
g
Detailed Design
Tested Units
Coding
Unit Testing
Code
Levels of Testing
LevelsofTesting
Type of Testing
Performed By
Lowleveltesting
Unit(module) testing
Integration
g
testingg
Programmer/Developer
Development team
Developmentteam
Highleveltesting
System testing
Function testing
Acceptance testing
IndependentTestGroup
Independent
Test Group
IndependentTestGroup
Customer
Testing Terms
TestingTerms
Test
Testcase
case Asetof
A set of Inputs,executionpreconditions,and
Inputs, execution preconditions, and
expectedoutcomesfortestinganspecificaspectofCUT
TestSuite
Test Suite Acollection
A collection oftestcasesfortheCUT
of test cases for the CUT
TestCriterion Asetoftestrequirements
Failure
Failure Anobservation
An observation ofthebehaviorofCUTdifferentfrom
of the behavior of CUT different from
expectedone
Fault
Fault Acondition
A condition inCUTthatmaycausefailure
in CUT that may cause failure
Effectiveness Faultdetectioncapability
Efficiency Theaveragetestingcost(i.e.effort)toidentifya
fault intheprogram
A Testing Process
ATestingProcess
The Code Under Test (and
its Specifications)
Procedural
Systems
Object-Oriented
Systems
Comparison with
Expected Outcomes
(Test Oracle)
NO
Stop?
YES
Stop
ATestingProcess
g
The Code Under Test (and
its Specifications)
Procedural
Systems
Object-Oriented
Systems
Comparison with
Expected Outcomes
(Test Oracle)
YES
Fail
?
Debugging/
Bug Fixing
NO
Stop?
YES
Stop
A Testing Process
ATestingProcess
The Code Under Test (and
its Specification)
Procedural
Systems
Object-Oriented
Systems
Comparison with
Expected Outcomes
(Test Oracle)
YES
Debugging/
Bug Fixing
Fail
?
NO
Stop
NO
Stop?
YES
Stop
Unit Testing
UnitTesting
Doneonindividualunits(Class
Done on individual units (Class orsmallcluster
or small cluster
classesinOOSystemandafunction ormodules
in Procedural Systems)
inProceduralSystems)
Testunitw.r.tunitspecification
Mostlydonebydevelopers/programmers
M l d
b d l
/
requiresstubs anddrivers
FurtherPopularizedbytheavailabilityof Unit
TestingFrameworks
g
StubsandDrivers
Stub
Stub
dummyunitswhich
simulates the
simulatesthe
functionofother
units required to
unitsrequiredto
testunitundertest
Driver
e.g.
g unit
relationships
eg.
g to unit test B
in isolation
Stub for A
A
Driver
Codethatexecutes
unit under test
unitundertest
C
Stub for C
Integration Testing
IntegrationTesting
Testsagroupofunits,modules,orasubsystem
Testsubsystemstructurew.r.tdesign,subsystem
y
g ,
y
functions
Focusesonunit
Focuses on unit interfaces
Donebyone/groupofdevelopers
Undertakenbasedondependency considerations
IntegrationTestApproaches
g
pp
Nonincremental(BigBangintegration)
Non incremental (Big Bang integration )
Incremental
Comparison
Non Incremental
NonIncremental
Incremental
requiresmorestubs,drivers
requireslessstubs,drivers
moduleinterfacingerrors
detectedlate
moduleinterfacingerrors
detectedearly
debuggingerrorsisdifficult
debuggingerrorsiseasier
resultsinmorethoroughtesting
g
g
ofmodules
E
Example:IntegrationTestinginFunctionalSystems
l I
i T i i F
i
lS
Example:IntegrationTestinginOOSystems
A
Topdown Integration
TopdownIntegration
Begin with the top module in the module call
hierarchy
Stub modules are produced
Stubs are often complicated
TopdownIntegrationTesting
Example:
A
Stub B
Stub C
Stub D
TopdownIntegrationTesting
Example:
Stub E
Stub F
Stub C
Stub D
BottomUpIntegration
Beginwiththeterminalmodules(thosethat
do not call other modules) of the modules call
donotcallothermodules)ofthemodulescall
hierarchy
Adrivermoduleisproducedforeverymodule
p
y
Thenextmoduletobetestedisanymodule
whosesubordinatemodules(themodulesit
calls)haveallbeentested
ll ) h
ll b
t t d
Afteramodulehasbeentested,itsdriveris
replaced by an actual module (the next one to
replacedbyanactualmodule(thenextoneto
betested)anditsdriver
Example:ModuleHierarchy
A
BottomUpIntegrationTesting
Example:
Driver E
Driver F
BottomUpIntegrationTesting
Example:
Driver A
Comparison
TopdownIntegration
Advantage
askeletalversionofthe
programcanexistearly
Disadvantage
BottomupIntegration
Disadvantage
theprogramasawholedoes
t i t til th l t
d l
notexistuntilthelastmodule
isadded
requiredstubscouldbe
q
expensive
No clear winner
System Testing
SystemTesting
Process of attempting to demonstrate that
the program or system does not meet its
original requirements
req irements and objectives
objecti es as
stated in the requirements specification
Test cases derived from
requirements specification
system objectives, user documentation
Volume testing
to determine whether the program can handle the required volumes of data,
requests, etc.
Load/Stress testing
to identify peak load conditions at which the program will fail to handle required
processing loads within required time spans
Security Testing
to show that the programs security requirements can be subverted
Performancetesting
todeterminewhethertheprogrammeetsitsperformance
requirements (eg response times throughput rates etc )
requirements(eg.responsetimes,throughputrates,etc.)
Recoverytesting
ttodeterminewhetherthesystemorprogrammeetsits
d t
i
h th th
t
t it
requirementsforrecoveryafterafailure
Installabilitytesting
Installability testing
toidentifywaysinwhichtheinstallationproceduresleadto
incorrectresults
ConfigurationTesting
todeterminewhethertheprogramoperatesproperlywhenthe
software or hardware is configured in a required manner
softwareorhardwareisconfiguredinarequiredmanner
Compatibility/conversiontesting
todeterminewhetherthecompatibilityobjectivesoftheprogram
p
y j
p g
havebeenmetandwhethertheconversionprocedureswork
Reliability/availabilitytesting
todeterminewhetherthesystemmeetsitsreliabilityand
availabilityrequirements
Resourceusagetesting
Resource usage testing
todeterminewhethertheprogramusesresources(memory,disk
space,etc.)atlevelswhichexceedrequirements
Acceptance Testing
AcceptanceTesting
Performed by the customer or end user
Compare the software to its initial
requirements and needs of its end users
Beta testing
conducted
d t d att one or more User
U
sites
it by
b th
the
end user of the SW
it is a live
live use of the SW in an environment
over which the developer has no control
Regression Testing
RegressionTesting
Testing changes made to the code
To ensure that no new bugs are introduced in the
y
system
Can be performed at any level unit, integration, and
system level
In practice, mostly performed at unit and system level in
GUI testing
Challenges include
#E
Errors ffound
#E
Errors found
40
403020101 2 3 4 5
W k
Week
40
403020101 2 3 4 5
W k
Week
Summary (PartII)
Summary(Part
II)
Testingisperformedatdifferentlevels
g p
UnitTestingisthefirstformaltestactivity
UnitTestingcanbehighlyefficientandcost
effective
ff i
IntegrationTestingisincremental
Regressiontestingisabouttestingchanges
R
i t ti i b t t ti
h
madetothecode
Toolsupportishighlydesirableinsoftware
Tool support is highly desirable in software
testing
y
Howcantheeffectivenessandefficiencyof
softwaretestingcanbeenhancedfurther?
R f
References
Beizer,Boris(1990).SoftwareTesting
Techniques (SecondEditioned.)
(Second Edition ed )
Myers,Glenford J.(1979).TheArtofSoftware
Testing.JohnWileyandSons
Wikipedia
Wikipedia http://en.wikipedia.org/wiki/Software_testing
http://en wikipedia org/wiki/Software testing