CoffeeMaker Example

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

9/4/2016 CoffeeMakerExample

CoffeeMakerExample

LaurieWilliams,DrightHo,andSarahHeckman[ContactAuthors]
NorthCarolinaStateUniversity
CSC326SoftwareEngineering

BacktoSoftwareEngineeringTutorials

TheComputerSciencedepartmentatNCSUhasanewbuildingonCentennialCampus.Weallknowthatcomputerscientistslovecaffeine,
sotheCSCdepartmentisplanningoninstallingaCoffeeMakerinaloungeacrossthehallfromthe24hourcomputerlab.Ourjobistotest
andmodelthefunctionalityoftheCoffeeMaker.Weareonlyworkingwiththelogiccodebehindthehardware,soonlyacommandline
interfaceisusedformanualtesting.HereisapartiallistingofrequirementsfortheCoffeeMakersystem.Usethisasareferencewhen
completingtheCSC326tutorials.

RequirementsUserStories

Title:WaitingState

AccTest:checkOptions0 Priority:1 StoryPoints:2

WhentheCoffeeMakerisnotinuseitwaitsforuserinput.Therearesixdifferentoptions
ofuserinput:1)addrecipe,2)deletearecipe,3)editarecipe,4)addinventory,5)check
inventory,and6)purchasebeverage.

Title:AddaRecipe

AccTest:addRecipe1 Priority:1 StoryPoints:2

OnlythreerecipesmaybeaddedtotheCoffeeMaker.Arecipeconsistsofaname,price,
unitsofcoffee,unitsofmilk,unitsofsugar,andunitsofchocolate.Eachrecipenamemust
beuniqueintherecipelist.Pricemustbehandledasaninteger.Astatusmessageis
printedtospecifyiftherecipewassuccessfullyaddedornot.Uponcompletion,the
CoffeeMakerisreturnedtothewaitingstate.

Title:DeleteaRecipe

AccTest:deleteRecipe1 Priority:2 StoryPoints:1

ArecipemaybedeletedfromtheCoffeeMakerifitexistsinthelistofrecipesinthe
CoffeeMaker.Therecipesarelistedbytheirname.Uponcompletion,astatusmessageis
printedandtheCoffeeMakerisreturnedtothewaitingstate.

Title:EditaRecipe

AccTest:editRecipe1 Priority:2 StoryPoints:1

ArecipemaybeeditedintheCoffeeMakerifitexistsinthelistofrecipesinthe
CoffeeMaker.Therecipesarelistedbytheirname.Afterselectingarecipetoedit,theuser
willthenenterthenewrecipeinformation.Arecipenamemaynotbechanged.Upon
completion,astatusmessageisprintedandtheCoffeeMakerisreturnedtothewaiting
state.

Title:AddInventory

AccTest:addInventory1 Priority:1 StoryPoints:2

Inventorymaybeaddedtothemachineatanytimefromthemainmenu,andisaddedto
thecurrentinventoryintheCoffeeMaker.ThetypesofinventoryintheCoffeeMakerare
coffee,milk,sugar,andchocolate.Theinventoryismeasuredinintegerunits.Inventory
mayonlyberemovedfromtheCoffeeMakerbypurchasingabeverage.Uponcompletion,
astatusmessageisprintedandtheCoffeeMakerisreturnedtothewaitingstate.

Title:CheckInventory

AccTest:checkInventory Priority:2 StoryPoints:1

http://agile.csc.ncsu.edu/SEMaterials/tutorials/coffee_maker/#user_stories 1/3
9/4/2016 CoffeeMakerExample

Inventorymaybecheckedatanytimefromthemainmenu.Theunitsofeachiteminthe
inventoryaredisplayed.Uponcompletion,theCoffeeMakerisreturnedtothewaiting
state.

Title:PurchaseBeverage

AccTest:purchaseBeverage1 Priority:1 StoryPoints:2

Theuserselectsabeverageandinsertsanamountofmoney.Themoneymustbean
integer.IfthebeverageisintheRecipeBookandtheuserpaidenoughmoneythe
beveragewillbedispensedandanychangewillbereturned.Theuserwillnotbeableto
purchaseabeverageiftheydonotdepositenoughmoneyintotheCoffeeMaker.Auser's
moneywillbereturnedifthereisnotenoughinventorytomakethebeverage.Upon
completion,theCoffeeMakerdisplaysamessageaboutthepurchasestatusandis
returnedtothemainmenu.

RequirementsUseCases

UC1:FlowofEventsfortheWaitingStateUseCase
1.1Preconditions:None
1.2MainFlow:TheCoffeeMakerwaitsforuserinput.Therearesixoptionstochosefrom[E1]:1)addrecipe[UC2],2)deletearecipe[UC3],
3)editarecipe[UC4],4)addinventory[UC5],5)checkinventory[UC6],and6)purchasebeverage[UC7].

UC2:FlowofEventsfortheAddRecipeUseCase
2.1Preconditions:None
2.2MainFlow:Auserselectsthemenuoptiontoaddarecipe.Theuserentersthename,price[E2][E3][E4],unitscoffee[E2][E3][E4],units
sugar[E2][E3][E4],unitsmilk[E2][E3][E4],andunitschocolate[E2][E3][E4]thatmakeuptherecipe.[E1][E5]
2.3Subflows:None
2.4AlternativeFlows:
[E1]Iftherearealreadythreerecipesinthesystem,thenanewrecipemaynotbeadded.Theuserisreturnedtothemainmenu.
[E2]Thepricemustbeainteger.Ifthepriceisnotanintegerthen,astatusmessageisprinted,andtheuserisreturnedtothemainmenu.
[E3]Theunitsofcoffee,sugar,milk,andchocolatemustbeintegers.Iftheunitvalueonanyoftheingredientsisnotaninteger,astatus
messageisprinted,andtheuserisreturnedtothemainmenu.
[E4]Thepriceandunitsofingredientsmustbepositive.Ifanynumberisnegative,astatusmessageisprinted,andtheuserisreturnedto
themainmenu.
[E5]Ifthenameofthenewrecipealreadyexistsinarecipeinthesystem,thenewrecipewillnotbeadded.

http://agile.csc.ncsu.edu/SEMaterials/tutorials/coffee_maker/#user_stories 2/3
9/4/2016 CoffeeMakerExample
UC3:FlowofEventsfortheDeleteRecipeUseCase
3.1Preconditions:None
3.2MainFlow:Theuserwillbeshownalistofallrecipesinthesystem,andaskedtochoosetherecipe,bynumber,thattheywishtodelete.
[S1][E1][E2][E3]
3.3Subflows:
[S1]Amessageisprinteddescribingthesuccessfuldeletionoftheselectedrecipe.
3.4AlternativeFlows:
[E1]Iftheuserselectsanumberthatisoutofboundsofthenumberofrecipes,theuserisreturnedtothemainmenu.
[E2]Iftheuserentersaalphabeticcharacter,theuserisreturnedtothemainmenu.
[E3]Iftheuserselectsanemptyrecipetodelete,theuserisreturnedtothemainmenu.

UC4:FlowofEventsfortheEditRecipeUseCase
4.1Preconditions:None
4.2MainFlow:Theuserwillbeshownalistofallrecipesinthesystem,andaskedtochoosetherecipe,bynumber,thattheywishtoedit.
[E1][E2]Theuserenterstheprice[E3][E4][E5],unitscoffee[E3][E4][E5],unitssugar[E3][E4][E5],unitsmilk[E3][E4][E5],andunitschocolate
[E3][E4][E5]thatmakeupthemodifiedselectedrecipe.[E6]
4.3Subflows:None
4.4AlternativeFlows:
[E1]Iftheuserselectsanumberthatisoutofboundsofthenumberofrecipes,theuserisreturnedtothemainmenu.
[E2]Iftheuserentersaalphabeticcharacter,theuserisreturnedtothemainmenu.
[E3]Thepricemustbeainteger.Ifthepriceisnotanumberthen,astatusmessageisprinted,andtheuserisreturnedtothemainmenu.
[E4]Theunitsofcoffee,sugar,milk,andchocolatemustbeintegers.Iftheunitvalueonanyoftheingredientsisnotaninteger,astatus
messageisprinted,andtheuserisreturnedtothemainmenu.
[E5]Thepriceandunitsofingredientsmustbepositive.Ifanynumberisnegative,astatusmessageisprinted,andtheuserisreturnedto
themainmenu.
[E6]Iftheuserselectsanemptyrecipetoedit,theuserisreturnedtothemainmenu.

UC5:FlowofEventsfortheAddInventoryUseCase
5.1Preconditions:None
5.2MainFlow:Theuserwillbepromptedfortheunitsofeachofthefouringredientstheywishtoaddtotheinventory.[E1][E2]
5.3Subflows:None
5.4AlternativeFlows:
[E1]IftheuserselectsanumberthatisnegativeoranonInteger,theuserwillberepromptedfortheamount.
[E2]Iftheuserentersaalphabeticcharacter,theuserwillberepromptedfortheamount.

UC6:FlowofEventsfortheCheckInventoryUseCase
6.1Preconditions:None
6.2MainFlow:TheuserwillbeshownalistingoftheinventoryofingredientsintheCoffeeMaker
6.3Subflows:None
6.4AlternativeFlows:None

UC7:FlowofEventsforthePurchaseBeverageUseCase
7.1Preconditions:None
7.2MainFlow:Theuserwillselectthebeveragetheywishtopurchase.Theuserwilldepositmoneytopayforthebeverage.[S1][S2]
7.3Subflows:
[S1]TheCoffeeMakerwillcheckifthereareenoughingredientsintheinventorytomaketheselecteddrink.[E1]
[S2]TheCoffeeMakerwillmakesureenoughmoneywasdeposited[E2],thebeveragewillbedispensed,andanyextrachangewillbe
returned.
7.4AlternativeFlows:
[E1]Ifthereisnotenoughinventorytomakethebeverage,amessagewillbedisplayed,theuser'smoneywillbereturned,andtheuserwill
bereturnedtothemainmenu.
[E2]Iftheuserdoesnotenterenoughmoney,theirmoneywillbereturned,andtheuserwillbereturnedtothemainmenu.

Requirements Design Test Code

UserStories ClassDiagram Acceptance CoffeeMaker_JUnit.zipJUnitTutorial


UseCases SequenceDiagram Tests CoffeeMaker_FIT.zipFITTutorial
UseCase CoffeeMaker_Web.zipJSPTutorial
Diagram CoffeeMaker_WebDB.zipJDBCTutorial
CoffeeMaker_WebTest.zipHttpUnitTutorial
CoffeeMaker_Coverage.zipEclEmma,JazzTest
Coverage,djUnit,MuClipse

BacktoSoftwareEngineeringTutorials

CoffeeMakerExampleforCSC326Tutorials20032008NorthCarolinaStateUniversity,LaurieWilliams,DrightHo,SarahHeckman
Emailtheauthorswithanyquestionsorcommentsaboutthisexample.
LastUpdated:Monday,March30,20093:34PM

http://agile.csc.ncsu.edu/SEMaterials/tutorials/coffee_maker/#user_stories 3/3

You might also like