uw adc - course 3 - class 1 - user stories and acceptance testing
DESCRIPTION
TRANSCRIPT
UniversityofWashingtonAgileDeveloperCer6ficate
SpringQuarterAdvancedTopicsinAgileSo>wareDevelopmentClass#1:UserStoriesandAcceptanceTes6ng
UserStoriesStory 14 As a customer I want to check my order status online so that I can know when to
expect my package
Asmallpieceofbusinessvaluethatcanbe
deliveredinanitera6on
WhyUserStories?
• AgilePrinciple:– “Themostefficientandeffec6vemethodofconveying
informa6ontoandwithinadevelopmentteamisface‐to‐faceconversa6on”
• UserStoriesareinsufficienttoimplementwithoutaconversa6onbetweenthecustomeranddeliveryteam
• Describever6calslicesoffunc6onality• Wordsneedcontexttointerpret;requirementsareinterpretedoutofcontextinmanycases
WhatisaUserStory?*• CARD
– Tokenrepresen6ngtherequirement.It'susedinplanning.NotesarewriVenonit,reflec6ngpriorityandcost
• CONVERSATION
– Therequirementitselfiscommunicatedfromcustomertoprogrammersthroughconversa6on(Theconversa6onislargelyverbal,butiso>ensupplementedwithdocuments)
• CONFIRMATION
– Theconfirma6onprovidedbytheacceptancetestiswhatmakespossiblethesimpleapproachofcardandconversa6on
– Whentheconversa6onaboutacardgetsdowntothedetailsoftheacceptancetest,thecustomerandprogrammerseVlethefinaldetailsofwhatneedstobedone
*“Essen6alXP:Card,Conversa6on,Confirma6on”–RonJeffrieshVp://www.xprogramming.com/xpmag/EXPCardConversa6onConfirma6on.htm
AUserStoryTemplate(CARD)
• Describesthevalueoffunc6onalityfromauser’sperspec6ve
• UserRole–auseroftheproduct• DoSomething–featureuserneeds• Value/Benefit–whyfeatureisimportant
User Story Template As a <<user role>>
I want to <<do something>> so that <<value/benefit>>
TheINVESTModelI–N–V–E–S–T
• I= Independent‐dependenciesreduceagility
• N= Nego6able‐nego6a6onbreedscollabora6on• V= Valuable‐valuabletotheProductOwner,
client,customeranduser
• E= Es6mable‐storiesareplanningtools• S= SizedAppropriately‐canbepredictably
completedanddelivered
• T= Testable‐story(acceptance)testsdefine whenweare“done”
Source:adaptedfromBillWake,xp123.com(h<p://xp123.com/xplor/xp0308/index.shtml)
TypesofUserStories
• Epic–auserstorythathasnotbeendecomposedtomeetINVESTmodelbecauseitislowerpriority
• Theme–acollec6onofrelateduserstories
• AnEpicisaThemewhensplitintosmallerUserStories
Interconnec6onsofaUserStory
TheRightConversaHon
DefineDone
IncrementalDelivery
UserPerspecHveAndFocus
EsHmates
Value
DomainModel,SystemMetaphor,GlossaryofTerms
User Story • Card• Conversa6on• Confirma6on
Exercise:UserStoryWri6ng
WriteUserStoriesfortheJiVerwebapplica6on.
ID8.5
AcceptanceTests
• Telluswhetherthesystemdoeswhatthecustomerexpects
• EnableDeveloperstoknowthey’vesa6sfiedrequirements
• Helpsusbuildthe“right”so>ware• Arealsocalledcustomertestsorfunc6onaltests• Canbeautomatedsothesecanbeverifiedbyanyoneatany6me
• “Running,TestedFeatures”**Adaptedfrom“AMetricLeadingtoAgility”–RonJeffrieshVp://www.xprogramming.com/xpmag/jatRtsMetric.htm
Confirma6onThroughAcceptanceCriteria
• ProductOwnermakesfirstpassatAcceptanceCriteriabeforeSprintPlanningMee6ng
• DuringSprintPlanning,AcceptanceCriteriaarediscussed• FinalAcceptanceCriteriaforeachUserStoryisanego6a6on
betweenDeliveryTeamandProductOwner
• Shouldbeshort,easytounderstandstatements
Story 14 As a customer, I want to check my
order status online so that I can know when to expect my package
AcceptanceCriteria• Viewstatusas“wai6ngforpickup”,“enroute”or“delivered”• Dateofeachstepinroute• Es6mated6meofdelivery
ComparingAcceptanceCriteriatoDefini6onofDone
DefiniHonofDone:Helpsusbuildthethingright(deliverables)
AcceptanceCriteria:Helpsusbuildtherightthing(funcHonality)
AcceptanceCriteria• Viewstatusas“wai6ngforpickup”,“enroute”or“delivered”• Dateofeachstepinroute• Es6mated6meofdelivery
UserStory“Smells”• Splitalongprocesslines
– Design,code,test,document
• Splitacrossarchitecturelines– Database,BusinessTier,UI
• Splitalongprocedurallines– Dothis,thenthis,andfinallythis
• Hardtounderstandfully• Customervalueisnotclear
*RequirementtoUserStory–ACaseStudy
• Ourstar6ngrequirement:
Story 1 Anyonecanregisterbypaying
immediatelywithPayPal
*Modifiedfromoriginalar6clebyJ.R.Rainsberger‐hVp://www.jbrains.info/weblog/browse/9
*RequirementtoUserStory–ACaseStudy
• Maybebreakitalongprocesslines?:Story 1.1
Design:AnyonecanregisterbypayingimmediatelywithPayPal
Story 1.3
UnitTest:Anyonecanregisterbypayingimmediatelywith
PayPal
Story 1.2
Code:AnyonecanregisterbypayingimmediatelywithPayPal
Story 1.4
Func6onalTest:Anyonecanregisterbypayingimmediately
withPayPal
*Modifiedfromoriginalar6clebyJ.R.Rainsberger‐hVp://www.jbrains.info/weblog/browse/9
*RequirementtoUserStory–ACaseStudy
• Maybebreakitalongarchitecturelines?:
Story 1.1
UI:AnyonecanregisterbypayingimmediatelywithPayPal
Story 1.3
Database:Anyonecanregisterbypayingimmediatelywith
PayPal
Story 1.2
BusinessLogic:Anyonecanregisterbypayingimmediately
withPayPal
Story 1.4
QA:AnyonecanregisterbypayingimmediatelywithPayPal
*Modifiedfromoriginalar6clebyJ.R.Rainsberger‐hVp://www.jbrains.info/weblog/browse/9
*RequirementtoUserStory–ACaseStudy
• Maybebreakitalongprocedurallines?:
Story 1.1
Collectregistra6oninforma6on
Story 1.3
Emailregistranta>erpayment
Story 1.2
IntegratewithPayPal
Story 1.4
Emailorganizera>erpayment
*Modifiedfromoriginalar6clebyJ.R.Rainsberger‐hVp://www.jbrains.info/weblog/browse/9
*RequirementtoUserStory–ACaseStudy
• Aha,self‐containedincrementsofvalue…
Story 1.1
AsaRegistrantIwanttoregisterwithmyemailsothatIcanbeno6fiedelectronically
Story 1.3
AsaRegistrantIwanttobeno6fiedofmyprocessed
registra6onsothatIknowitiscomplete
Story 1.2
AsanOrganizerIwanttocollectmoreinforma6onfromRegistrantsothatIcancontact
themlater
Story 1.4
AsanOrganizerIwanttobeno6fiedofaregistra6onsothat
Icanfulfillit
*Modifiedfromoriginalar6clebyJ.R.Rainsberger‐hVp://www.jbrains.info/weblog/browse/9
MoreGuidelinesforSpliqngStories
• Databoundaries• Opera6onalboundaries• Excep6ons• Errorhandling• Removingcross‐cuqngconcerns
• Priority
Avoidspliqngstoriestoosoon
• Don’tsplitstoriestoosoon– ResultsinhugeinventoryonProductBacklog(waste)– Iner6asetsinandclogssystem– Manydetailswilllikelybethrownout,resul6ngin“sunkcosts”
• Progressivelyelaboratestoriesbasedon– Priority– Risk
• Effec6velyspliqngstoriesisajointeffort– ProductOwner,Stakeholders– Team
TheneedforFITFIT:FrameworkforIntegratedTests
• CreatedbyWardCunningham
• Allowscustomers,testers,andprogrammerstolearnwhattheirso>wareshoulddoandwhatitdoesdo.
• Automa6callycomparescustomers'expecta6onstoactualresults• Simpletableformat
• Easyforeveryonetounderstandandmaintaintests
• Powerfulframeworktotestalmostanythingthebusinesscaresabout
• Book:“FITforDevelopingSo>ware”(Mugridge,Cunningham)hVp://www.amazon.com/Fit‐Developing‐So>ware‐Framework‐Integrated/dp/0321269349/
http://fit.c2.com
FITorFitNesse?
• FIT:coreframeworkfortes6ng– Command‐linetool:easilyscriptable
– TestsareWordorExceldocumentssavedasHTML
• FitNesse:Web‐basedfrontendforFIT– Easilyaccessibletoanyone– TestsareWikipages
– Helpsorganizetestsintosuites
Source: Alex Pukinskis – “Flawless Iterations” – Agile 2005
WhatdoesFITtest?
• Whateveryouwant…– Businessrules– Integra6onpoints– Businessservices– Workflows
– UIsteps
AsimpleexampleofaFITtest
*Source: http://fit.c2.com/
FitWorkflow*
• Startswithwhiteboardconversa6on• Customer(SME,businessperson,productmanager,etc.)informallydescribenewfeature
• Programmersandtestersaskques6ons
*Source: http://fit.c2.com/
FitWorkflow*
• Customer,workingwithdeliveryteam,refinesexamplesintotables
• Usebusiness‐friendlytools,suchasMicroso>ExcelandWord,tocapturetesttables
*Source: http://fit.c2.com/
FitWorkflow*
• Deliveryteamsuggestaddi6onalareastocover
*Source: http://fit.c2.com/
FitWorkflow*
• DeliveryteamformattablesforusewithFit
*Source: http://fit.c2.com/
FitWorkflow*
• DeliveryteamcreatesFit“fixtures”(smallpieceofcodethattranslatestesttablesintoexecu6ontestsagainsttheso>ware)
*Source: http://fit.c2.com/
FitWorkflow*
• ExecuteFitdocumentagainstso>ware• Atfirstsometestsmaybefailing(red)
*Source: http://fit.c2.com/
FitWorkflow*• Deliveryteamcollaborateswithcustomertoincrementallyenhancetesttables
• Deliveryteamimplementsso>waretomeettestexecu6on(green)*Source: http://fit.c2.com/
FitWorkflow*
• Documentiskeptforregressiontes6ng• Documentisincludedinautomatedbuildtoensureeverythingkeepsworking
• Asques6onsariseaboutfunc6onalityanexampleisaddedandFitreportstheanswer
*Source: http://fit.c2.com/
Exercise:AcceptanceTests
Createini6alacceptancetestsusingFitgoingthroughen6reworkflow.
HowdoesFITwork?
Source: Alex Pukinskis – “Flawless Iterations” – Agile 2005
Howdeep/widetotestwithFit?
• Bestusedfor“businessrules”• JustunderUIlayer• CantestUIworkflowbutbriVle(UIchangesoccurmoreo>en)
• Testserviceinterfaces(SOA,J2EE,…)• Definehowsystemshouldhandlesitua6ons
• Acceptancetestsshouldtestintegratedsystem
ColumnFixture
• ColumnFixturemapscolumnstofixtureelements• Greatfortes6ngcalcula6ons• Abstract‐doesn’tdefinehowbusinessruleisused• GenerallytheleastbriVletables
eg.Calculator key x() flash()
100 100 false enter 100 false 0 0 false / 0 true clx 0 false
*Source: http://fit.c2.com/
RowFixture
• RowFixturecomparesrowsintestdatatoresultsfromsystemundertest
• Returnedvaluescomparedtothoseintable• Algorithmmatchesrowswithsystemresultsbasedononeormorekeys
Times
task total time total billing
background 8:00 0.00
stqe 6:00 0.00
usda 0:00 0.00
conference 10:00 1500.00
*Source: http://fit.c2.com/
Ac6onFixture
• Ac6onFixtureinterpretsrowsassequenceofcommandsperformedinorder
• Firstcolumncontainscommand
• Subsequentcolumnscontainsvaluesinterpretedbycommand
• GenericAc6onFixturecommandsare:– startaClass‐directedtoinstanceofaClass,similartonaviga6ngtoapar6cular
GUIscreen
– enteraMethodanArgument‐invokeaMethodwithanArgument,similartoenteringvaluesintoGUIfields
– pressaMethod‐invokeaMethodwithnoarguments,similartopressingGUIbuVon
– checkaMethodaValue‐‐invokeaMethodwithnoarguments,comparereturnedvaluewithaValue,similartoreadingvaluesfromGUIscreen
Ac6onFixtureexample• Searchingformusic…
eg.music.Realtime
enter select 2 pick an album
press same album find more like it
check status searching
await search complete
check status ready
check selected songs 2
*Source: http://fit.c2.com/
Bringingitalltogether• Usesequencesoftables• Build/Operate/CheckPaVern(hVp://fitnesse.org/)– Oneormoretablestobuildtestdata(ColumnFixture)
– Usetabletooperateondata– UseColumnFixtureorRowFixturetoverifytheresults
• Cleanupdatacreated
FitLibraryAddi6onalFixtures
• CommonFitusagepaVernsprovidedbyframework
• Allowsmoresophis6catedtests– DoFixture‐tes6ngac6onsondomainobjects– SetupFixture‐repe66vedataentryatstartoftest– CalculateFixture‐alterna6vetoColumnFixture– ArrayFixture‐orderedlistshandledautoma6cally– SubsetFixture‐testspecificelementsofalist
• Canoperatedirectlyonsystemcomponentswithoutwri6ngcustomfixtures
OrganizingFITtests
• Maintainsuiteofregressiontestsfrompastitera6onsthatalwayspass
• Run“regression”testswithbuild.• Maintainasuiteof“inprogress”testsforthecurrentitera6on– Begintheitera6onwithalltestsfailing– Endtheitera6onwithmosttestspassing
• Attheendoftheitera6on,movenewlypassingtestsintoregressionsuite– BewaretheFitnesse“Refactor/Move”command
ExecutableRequirements
• Unambiguousdefini6onofrequirements• Executabledocumenta6on
• Repeatableandspecific• Thesecond‐mostdetailedspecifica6onofthecustomer’srequest
OtherAgileTes6ngTools
• OpenSourceWebUITes6ngtools– StoryTestIQ– WATiR– Selenium
– CanooWebTest
• Gothe“lastmile”toverifythingsfittogether
• TestswriVenandmaintainedincrementally• TendtobemorebriVle
Whatabouttradi6onaltes6ngtools?
• Whydon’tweuseSilkTest,TestDirector,QuickTestPro,etc.forAgiletes6ng?– Expensive– Automatedtoolsarerecord‐and‐playback;briVle
– TiesourteststotheUIimplementa6on– Manualtools(TestDirector)taketoolongtorun.
– Workfineasaninterimstrategy(especiallyifyoualreadyhavethelicenses)
– ConsideraddingFITasacomponentofyourtes6ng