Sie sind auf Seite 1von 29

ObjectOrientedSoftwareEngineering

UsingUML,Patterns,andJava
andSystemTesting
Chapter11:Integration
IntegrationTestingStrategy
Subsystem=?
Theentiresystemisviewedasacollectionofsubsystems(sets
ofclasses)determinedduringthesystemandobjectdesign.
Theorderinwhichthesubsystemsareselectedfortestingand
integrationdeterminesthetestingstrategy
Bigbangintegration(Nonincremental)
Bottomupintegration
Topdownintegration
Sandwichtesting
Variationsoftheabove
Fortheselectionusethesystemdecompositionfromthe
SystemDesign
Recall:OOvs.architecturevs.designpatternvs.REallmovingtargets
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 2
Example:ThreeLayerCallHierarchy

A
LayerI

B C D LayerII

E F G LayerIII

WhatwouldA,BandDlooklike?
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 3
IntegrationTesting:BigBangApproach

UnitTest
A
Donttrythis!
UnitTest
B
UnitTest
C
SystemTest
UnitTest
D
UnitTest
E

UnitTest
F

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 4
BottomupIntegration A
LayerI

B C D LayerII

TestE G
E F LayerIII

TestB,E,F

TestF

TestC Test
A,B,C,D,
E,F,G

TestD,G
TestG

Specialprogramneededtodothetesting,TestDriver:
Aroutinethatcallsasubsystemandpassesatestcasetoit
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 5
ProsandConsofbottomupintegrationtesting

Badforfunctionallydecomposedsystems:
Teststhemostimportantsubsystem(UI)last
Usefulforintegratingthefollowingsystems
Objectorientedsystems
realtimesystems
systemswithstrictperformancerequirements

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 6
TopdownIntegrationTesting A
LayerI

B C D LayerII

E F G
LayerIII

Test
TestA TestA,B,C,D A,B,C,D,
E,F,G

LayerI
LayerI+II
AllLayers
Specialprogramisneededtodothetesting,Teststub:
Aprogramoramethodthatsimulatestheactivityofamissingsubsystembyansweringtothe
callingsequenceofthecallingsubsystemandreturningbackfakedata.
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 7
ProsandConsoftopdownintegrationtesting

Testcasescanbedefinedintermsofthefunctionalityofthe
system(functionalrequirements) Isthisenough?
Writingstubscanbedifficult:Stubsmustallowallpossible
conditionstobetested.
Possiblyaverylargenumberofstubsmayberequired,
especiallyifthelowestlevelofthesystemcontainsmany
methods.
Onesolutiontoavoidtoomanystubs:Modifiedtopdown
testingstrategy
Testeachlayerofthesystemdecompositionindividually
beforemergingthelayers
Disadvantageofmodifiedtopdowntesting:Both,stubs
anddriversareneeded
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 8
SandwichTestingStrategy

Combinestopdownstrategywithbottomupstrategy
Thesystemisviewashavingthreelayers
Atargetlayerinthemiddle
Alayerabovethetarget
Alayerbelowthetarget
Testingconvergesatthetargetlayer
Howdoyouselectthetargetlayeriftherearemorethan3
layers?
Heuristic:Trytominimizethenumberofstubsand
drivers

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 9
SandwichTestingStrategy A
LayerI

B C D LayerII

E F G
TestE LayerIII

up

Bottom TestB,E,F
Layer TestF
Tests
Test
A,B,C,D,
TestD,G E,F,G
TestG

TestA,B,C,D

Top TestA down


Layer
Tests
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 10
ProsandConsofSandwichTesting

TopandBottomLayerTestscanbedoneinparallel
Doesnottesttheindividualsubsystemsthoroughlybefore
integration
Solution:Modifiedsandwichtestingstrategy Selfreadingexercise

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 11
ModifiedSandwichTestingStrategy Selfreadingexercise

Testinparallel:
Middlelayerwithdriversandstubs
Toplayerwithstubs
Bottomlayerwithdrivers
Testinparallel:
Toplayeraccessingmiddlelayer(toplayerreplaces
drivers)
Bottomaccessedbymiddlelayer(bottomlayerreplaces
stubs)

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 12
Selfreadingexercise
ModifiedSandwichTestingStrategy Double
Double
TestI
TestI
A
LayerI
TestB
B C D LayerII
TestE
Triple
Triple E F G
LayerIII
Triple
Triple TestI
TestB,E,F TestI
TestI
TestI Double
Double
TestII
TestII
TestF

Test
TestD A,B,C,D,
Double
Double TestD,G E,F,G
TestII
TestII
TestG

TestA,C
TestA

TestC Double
Double
TestI
TestI
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 13
Selfreading
StepsinIntegrationTesting

1.Basedontheintegrationstrategy,
1.Basedontheintegrationstrategy,
4.Dostructuraltesting:Definetest
4.Dostructuraltesting:Definetest
selectacomponenttobetested.
selectacomponenttobetested. casesthatexercisetheselected
casesthatexercisetheselected
Unittestalltheclassesinthe
Unittestalltheclassesinthe component
component
component.
component. 5.Executeperformancetests
. 5.Executeperformancetests
2.Putselectedcomponenttogether;
2.Putselectedcomponenttogether; 6.Keeprecordsofthetestcasesand
doanypreliminaryfixup 6.Keeprecordsofthetestcasesand
doanypreliminaryfixup testingactivities.
testingactivities.
necessarytomaketheintegration
necessarytomaketheintegration
testoperational(drivers,stubs) 7.Repeatsteps1to7untilthefull
7.Repeatsteps1to7untilthefull
testoperational(drivers,stubs) systemistested.
3.Dofunctionaltesting:Definetest systemistested.
3.Dofunctionaltesting:Definetest
casesthatexerciseallusescases
casesthatexerciseallusescases
withtheselectedcomponent
withtheselectedcomponent Theprimarygoalofintegration
Theprimarygoalofintegration
Whatistherelationshipamongpackages, testingistoidentifyerrorsinthe
testingistoidentifyerrorsinthe
classes,components,interactions,activities, (current)component
(current)component
deploymentsandusecases? configuration.
configuration.

Whatwouldbemodeldrivensoftwaretesting?

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 14
Selfreading
WhichIntegrationStrategyshouldyouuse?

Factorstoconsider
Factorstoconsider ...Toplevelcomponentsare
...Toplevelcomponentsare
Amountoftestharness usuallyimportantand
usuallyimportantand
Amountoftestharness cannotbeneglecteduptothe
(stubs&drivers)
(stubs&drivers) bigcost cannotbeneglecteduptothe
endoftesting
endoftesting
Locationofcriticalpartsin
Locationofcriticalpartsin
thesystem Detectionofdesignerrors
Detectionofdesignerrors
thesystem what? postponeduntilendof
Availabilityofhardware postponeduntilendof
Availabilityofhardware testing
testing
Availabilityofcomponents
Availabilityofcomponents Topdownapproach
Topdownapproach
Schedulingconcerns
Schedulingconcerns Testcasescanbedefinedin
Testcasescanbedefinedin
Bottomupapproach
Bottomupapproach termsoffunctionsexamined
termsoffunctionsexamined
goodforobjectoriented
goodforobjectoriented Needtomaintaincorrectness
Needtomaintaincorrectness
designmethodologies
designmethodologies ofteststubs
ofteststubs
Testdriverinterfacesmust
Testdriverinterfacesmust Writingstubscanbe
Writingstubscanbe
matchcomponentinterfaces
matchcomponentinterfaces difficult
difficult
......

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 15
SystemTesting

FunctionalTesting
StructureTesting
PerformanceTesting
AcceptanceTesting
InstallationTesting

Impactofrequirementsonsystemtesting:
Themoreexplicittherequirements,theeasiertheyaretotest.
Qualityofusecasesdeterminestheeaseoffunctionaltesting
Qualityofsubsystemdecompositiondeterminestheeaseof
structuretesting
Qualityofnonfunctionalrequirementsandconstraintsdetermines
theeaseofperformancetests:

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 16
Selfreading
StructureTesting

Essentiallythesameaswhiteboxtesting.
Goal:Coverallpathsinthesystemdesign
Exerciseallinputandoutputparametersofeachcomponent.
Whatsaacomponentagain?

Exerciseallcomponentsandallcalls(eachcomponentiscalledat
leastonceandeverycomponentiscalledbyallpossiblecallers.)
Howdoweknowaboutallpossiblecallers?

Useconditionalanditerationtestingasinunittesting.

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 17
FunctionalTesting

.
Essentiallythesameasblackboxtesting
Goal:Testfunctionalityofsystem
Testcasesaredesignedfromtherequirementsanalysis
document(better:usermanual)andcenteredaround
requirementsandkeyfunctions(usecases)
Whatsinausecase?
Whatdowetest
.
Thesystemistreatedasblackbox.
Unittestcasescanbereused,butinenduserorientednewtest
caseshavetobedevelopedaswell.

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 18
PerformanceTesting

StressTesting Timingtesting
Stresslimitsofsystem(maximum#of Evaluateresponsetimesand
users,peakdemands,extended timetoperformafunction
operation) Environmentaltest
Volumetesting Testtolerancesforheat,
Testwhathappensiflargeamountsof humidity,motion,portability
dataarehandled Qualitytesting
Configurationtesting Testreliability,maintainability
Testthevarioussoftwareand &availabilityofthesystem
hardwareconfigurations Recoverytesting
Compatibilitytest Testssystemsresponseto
Testbackwardcompatibilitywith presenceoferrorsorlossof
existingsystems data.
Securitytesting Humanfactorstesting
Trytoviolatesecurityrequirements Testsuserinterfacewithuser

Isthislistenough?Whatarethe2typesofrequirements?
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 19
TestCasesforPerformanceTesting
Pushthe(integrated)systemtoitslimits.
Goal:Trytobreakthesubsystem
Testhowthesystembehaveswhenoverloaded.
Canbottlenecksbeidentified?(Firstcandidatesforredesigninthe
nextiteration
Tryunusualordersofexecution
Callareceive()beforesend()
Checkthesystemsresponsetolargevolumesofdata
Ifthesystemissupposedtohandle1000items,tryitwith1001
items.
Whatistheamountoftimespentindifferentusecases?
Aretypicalcasesexecutedinatimelyfashion?

Howmanyabnormal/exceptionalcasescantherebe?
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 20
AcceptanceTesting

Goal:Demonstratesystemis
Goal:Demonstratesystemis Alpha
Alphatest:
test:
readyforoperationaluse
readyforoperationaluse Sponsorusesthesoftwareat
Choiceoftestsismadeby Sponsorusesthesoftwareat
Choiceoftestsismadeby thedeveloperssite.
thedeveloperssite.
client
client/sponsor
/sponsor Softwareusedinacontrolled
Softwareusedinacontrolled
Manytestscanbetaken
Manytestscanbetaken setting,withthedeveloper
setting,withthedeveloper
fromintegrationtesting
fromintegrationtesting alwaysreadytofixbugs.
alwaysreadytofixbugs.
Acceptancetestisperformed
Acceptancetestisperformed Beta
Beta test:
test:
bytheclient,notbythe
bytheclient,notbythe
developer. Conductedatsponsorssite
Conductedatsponsorssite
developer.
Majorityofallbugsinsoftwareis
(developerisnotpresent)
(developerisnotpresent)
Majorityofallbugsinsoftwareis
typicallyfoundbytheclientafter Softwaregetsarealistic
Softwaregetsarealistic
typicallyfoundbytheclientafter
thesystemisinuse,notbythe
thesystemisinuse,notbythe workoutintargetenviron
workoutintargetenviron
developersortesters.Therefore
developersortesters.Therefore ment
ment
twokindsofadditionaltests:
twokindsofadditionaltests: Potentialcustomermightget
Potentialcustomermightget
discouraged
discouraged
Whatsethnomethodology?
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 21
TestinghasitsownLifeCycle

Establishthetestobjectives
Designthetestcases
Writethetestcases
Testthetestcases
Executethetests
Evaluatethetestresults
Changethesystem
Doregressiontesting

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 22
AlbertEinsteinWecan'tsolveproblems
byusingthesamekindofthinkingweused
TestTeam whenwecreatedthem.
Professional
Tester toofamiliar
Programmer withcode
Analyst

Test System
User Team Designer

Configuration
Management
Specialist
BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 23
Summary

Testingisstillablackart,butmanyrulesandheuristicsare
available
Testingconsistsofcomponenttesting(unittesting,integration
testing)andsystemtesting
DesignPatternscanbeusedforintegrationtesting
Testinghasitsownlifecycle
And

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 24
AdditionalSlides

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 25
UsingtheBridgePatterntoenableearlyIntegration
Testing
Usethebridgepatterntoprovidemultipleimplementations
underthesameinterface.
Interfacetoacomponentthatisincomplete,notyetknownor
unavailableduringtesting

SeatInterface SeatImplementation
VIP
(inVehicleSubsystem)

Simulated
StubCode RealSeat
Seat(SA/RT)

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 26
BottomupTestingStrategy

Thesubsysteminthelowestlayerofthecallhierarchyare
testedindividually
Thenthenextsubsystemsaretestedthatcallthepreviously
testedsubsystems
Thisisdonerepeatedlyuntilallsubsystemsareincludedinthe
testing
Specialprogramneededtodothetesting,TestDriver:
Aroutinethatcallsasubsystemandpassesatestcasetoit

SeatDriver SeatInterface SeatImplementation


(simulatesVIP) (inVehicleSubsystem)

Simulated
StubCode RealSeat
BerndBruegge&AllenH.Dutoit
Seat(SA/RT)
ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 27
TopdownTestingStrategy

Testthetoplayerorthecontrollingsubsystemfirst
Thencombineallthesubsystemsthatarecalledbythetested
subsystemsandtesttheresultingcollectionofsubsystems
Dothisuntilallsubsystemsareincorporatedintothetest
Specialprogramisneededtodothetesting,Teststub:
Aprogramoramethodthatsimulatestheactivityofamissing
subsystembyansweringtothecallingsequenceofthecalling
subsystemandreturningbackfakedata.

BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 28
SchedulingSandwichTests:Exampleofa
DependencyChart

UnitTests DoubleTests TripleTests SystemTests


BerndBruegge&AllenH.Dutoit ObjectOrientedSoftwareEngineering:UsingUML,Patterns,andJava 29