Test Cases for Atm System

download Test Cases for Atm System

of 26

Transcript of Test Cases for Atm System

  • 7/25/2019 Test Cases for Atm System

    1/26

    Requirements Statement for Example ATM System

    The software to be designed will control a simulated automated teller machine (ATM)having a magnetic stripe reader for reading an ATM card, a customer console (keyboardand display) for interaction with the customer, a slot for depositing envelopes, a dispenserfor cash (in multiples of $2), a printer for printing customer receipts, and a key!operatedswitch to allow an operator to start or stop the machine" The ATM will communicate with

    the bank#s computer over an appropriate communication link" (The software on the latteris not part of the reuirements for this problem")

    The ATM will service one customer at a time" A customer will be reuired to insert anATM card and enter a personal identification number (%&') ! both of which will be sentto the bank for validation as part of each transaction" The customer will then be able toperform one or more transactions" The card will be retained in the machine until thecustomer indicates that heshe desires no further transactions, at which point it will bereturned ! ecept as noted below"

    The ATM must be able to provide the following services to the customer*

    +" A customer must be able to make a cash withdrawal from any suitable accountlinked to the card, in multiples of $2"" Approval must be obtained from thebank before cash is dispensed"

    2" A customer must be able to make a deposit to any account linked to the card,consisting of cash andor checks in an envelope" The customer will enter theamount of the deposit into the ATM, subect to manual verification when theenvelope is removed from the machine by an operator" Approval must be obtainedfrom the bank before physically accepting the envelope"

    -" A customer must be able to make a transfer of money between any two accountslinked to the card"

    ." A customer must be able to make a balance inuiry of any account linked to thecard"

    A customer must be able to abort a transaction in progress by pressing the /ancel keyinstead of responding to a reuest from the machine"

    The ATM will communicate each transaction to the bank and obtain verification that itwas allowed by the bank" 0rdinarily, a transaction will be considered complete by thebank once it has been approved" &n the case of a deposit, a second message will be sent tothe bank indicating that the customer has deposited the envelope" (&f the customer fails todeposit the envelope within the timeout period, or presses cancel instead, no secondmessage will be sent to the bank and the deposit will not be credited to the customer")

    &f the bank determines that the customer#s %&' is invalid, the customer will be reuired tore!enter the %&' before a transaction can proceed" &f the customer is unable tosuccessfully enter the %&' after three tries, the card will be permanently retained by themachine, and the customer will have to contact the bank to get it back"

    &f a transaction fails for any reason other than an invalid %&', the ATM will display aneplanation of the problem, and will then ask the customer whether heshe wants to doanother transaction"

  • 7/25/2019 Test Cases for Atm System

    2/26

    The ATM will provide the customer with a printed receipt for each successful transaction,showing the date, time, machine location, type of transaction, account(s), amount, andending and available balance(s) of the affected account (1to1 account for transfers)"

    The ATM will have a key!operated switch that will allow an operator to start and stop theservicing of customers" After turning the switch to the 1on1 position, the operator will bereuired to verify and enter the total cash on hand" The machine can only be turned offwhen it is not servicing a customer" hen the switch is moved to the 1off1 position, the

    machine will shut down, so that the operator may remove deposit envelopes and reloadthe machine with cash, blank receipts, etc"

    The ATM will also maintain an internal log of transactions to facilitate resolvingambiguities arising from a hardware failure in the middle of a transaction" 3ntries will bemade in the log when the ATM is started up and shut down, for each message sent to the4ank (along with the response back, if one is epected), for the dispensing of cash, andfor the receiving of an envelope" 5og entries may contain card numbers and dollaramounts, but for security will nevercontain a %&'"

    Use Cases for Example ATM System

  • 7/25/2019 Test Cases for Atm System

    3/26

    Flows of Events for Individual Use Cases

    System Startup Use Case

    The system is started up when the operator turns the operator switch to the 1on1 position"The operator will be asked to enter the amount of money currently in the cash dispenser,and a connection to the bank will be established" Then the servicing of customers canbegin"

    System Shutdown Use Case

    The system is shut down when the operator makes sure that no customer is using themachine, and then turns the operator switch to the 1off1 position" The connection to thebank will be shut down" Then the operator is free to remove deposited envelopes,replenish cash and paper, etc"

    Session Use Case

    A session is started when a customer inserts an ATM card into the card reader slot of themachine" The ATM pulls the card into the machine and reads it" (&f the reader cannot readthe card due to improper insertion or a damaged stripe, the card is eected, an error screenis displayed, and the session is aborted") The customer is asked to enter hisher %&', andis then allowed to perform one or more transactions, choosing from a menu of possibletypes of transaction in each case" After each transaction, the customer is asked whetherheshe would like to perform another" hen the customer is through performingtransactions, the card is eected from the machine and the session ends" &f a transaction is

    aborted due to too many invalid %&' entries, the session is also aborted, with the cardbeing retained in the machine"

    The customer may abort the session by pressing the /ancel key when entering a %&' orchoosing a transaction type"

    Transaction Use Case

    Note: Transaction is an abstract generalization. Each specific concrete type oftransaction implements certain operations in the appropriate way. The flow of events

    given here describes the behavior common to all types of transaction. The flows of events

    for the individual types of transaction (withdrawal, deposit, transfer, inquiry give thefeatures that are specific to that type of transaction.

    A transaction use case is started within a session when the customer chooses a transactiontype from a menu of options" The customer will be asked to furnish appropriate details(e"g" account(s) involved, amount)" The transaction will then be sent to the bank, alongwith information from the customer#s card and the %&' the customer entered"

    &f the bank approves the transaction, any steps needed to complete the transaction (e"g"dispensing cash or accepting an envelope) will be performed, and then a receipt will beprinted" Then the customer will be asked whether heshe wishes to do another transaction"

  • 7/25/2019 Test Cases for Atm System

    4/26

    &f the bank reports that the customer#s %&' is invalid, the &nvalid %&' etension will beperformed and then an attempt will be made to continue the transaction" &f the customer#scard is retained due to too many invalid %&'s, the transaction will be aborted, and thecustomer will not be offered the option of doing another"

    &f a transaction is cancelled by the customer, or fails for any reason other than repeatedentries of an invalid %&', a screen will be displayed informing the customer of the reasonfor the failure of the transaction, and then the customer will be offered the opportunity to

    do another"

    The customer may cancel a transaction by pressing the /ancel key as described for eachindividual type of transaction below"

    All messages to the bank and responses back are recorded in the ATM#s log"

    Withdrawal Transaction Use Case

    A withdrawal transaction asks the customer to choose a type of account to withdraw from(e"g" checking) from a menu of possible accounts, and to choose a dollar amount from a

    menu of possible amounts" The system verifies that it has sufficient money on hand tosatisfy the reuest before sending the transaction to the bank" (&f not, the customer isinformed and asked to enter a different amount") &f the transaction is approved by thebank, the appropriate amount of cash is dispensed by the machine before it issues areceipt" (The dispensing of cash is also recorded in the ATM#s log")

    A withdrawal transaction can be cancelled by the customer pressing the /ancel key anytime prior to choosing the dollar amount"

    Deposit Transaction Use Case

    A deposit transaction asks the customer to choose a type of account to deposit to (e"g"checking) from a menu of possible accounts, and to type in a dollar amount on thekeyboard" The transaction is initially sent to the bank to verify that the ATM can accept adeposit from this customer to this account" &f the transaction is approved, the machineaccepts an envelope from the customer containing cash andor checks before it issues areceipt" 0nce the envelope has been received, a second message is sent to the bank, toconfirm that the bank can credit the customer#s account ! contingent on manualverification of the deposit envelope contents by an operator later" (The receipt of anenvelope is also recorded in the ATM#s log")

    A deposit transaction can be cancelled by the customer pressing the /ancel key any time

    prior to inserting the envelope containing the deposit" The transaction is automaticallycancelled if the customer fails to insert the envelope containing the deposit within areasonable period of time after being asked to do so"

    Transfer Transaction Use Case

    A transfer transaction asks the customer to choose a type of account to transfer from (e"g"checking) from a menu of possible accounts, to choose a different account to transfer to,and to type in a dollar amount on the keyboard" 'o further action is reuired once thetransaction is approved by the bank before printing the receipt"

  • 7/25/2019 Test Cases for Atm System

    5/26

    A transfer transaction can be cancelled by the customer pressing the /ancel key any timeprior to entering a dollar amount"

    nquiry Transaction Use Case

    An inuiry transaction asks the customer to choose a type of account to inuire aboutfrom a menu of possible accounts" 'o further action is reuired once the transaction isapproved by the bank before printing the receipt"

    An inuiry transaction can be cancelled by the customer pressing the /ancel key any time

    n!alid "# Extension

    An invalid %&' etension is started from within a transaction when the bank reports thatthe customer#s transaction is disapproved due to an invalid %&'" The customer is reuiredto re!enter the %&' and the original reuest is sent to the bank again" &f the bank nowapproves the transaction, or disapproves it for some other reason, the original use case iscontinued6 otherwise the process of re!entering the %&' is repeated" 0nce the %&' issuccessfully re!entered, it is used for both the current transaction and all subseuenttransactions in the session" &f the customer fails three times to enter the correct %&', thecard is permanently retained, a screen is displayed informing the customer of this andsuggesting heshe contact the bank, and the entire customer session is aborted"

    &f the customer presses cancel instead of re!entering a %&', the original transaction iscancelled"

    nitial $unctional Test Cases for Example ATM System

    The following initial test cases can be identified early in the design process as a vehicle

    for checking that the implementation is basically correct"No attempt has been made atthis point to do thorough testing, including all possible errors and boundary cases.Thatneeds to come later" These cases represent an initial check that the functionality specifiedby the use cases is present"

    7ome writers would argue for developing test cases like these in place ofuse cases" 8ere,they are presented as a vehicle for 1fleshing out1 the use cases, not as a substitute forthem"

    Use Case$unction %ein&

    Tested

    nitial System

    Statenput Expected 'utput

    7ystem7tartup

    7ystem is startedwhen the switch isturned 1on1

    7ystem is offActivate the 1on1switch

    7ystem reuests initial cashamount

    7ystem7tartup

    7ystem acceptsinitial cash amount

    7ystem isreuesting cashamount

    3nter a legitimateamount

    7ystem is on

    7ystem7tartup

    /onnection to thebank is established

    7ystem has ustbeen turned on

    %erform alegitimate inuirytransaction

    7ystem output shoulddemonstrate that aconnection has beenestablished to the 4ank

  • 7/25/2019 Test Cases for Atm System

    6/26

    Use Case$unction %ein&

    Tested

    nitial System

    Statenput Expected 'utput

    7ystem7tartup

    7ystem is startedwhen the switch isturned 1on1

    7ystem is offActivate the 1on1switch

    7ystem reuests initial cashamount

    7ystem7hutdown

    7ystem is shutdown when theswitch is turned1off1

    7ystem is on andnot servicing a

    customer

    Activate the 1off1switch

    7ystem is off

    7ystem7hutdown

    /onnection to the4ank is terminatedwhen the system isshut down

    7ystem has ustbeen shut down

    9erify from the bank sidethat a connection to the ATMno longer eists

    7ession7ystem reads acustomer#s ATMcard

    7ystem is on andnot servicing acustomer

    &nsert a readablecard

    /ard is accepted67ystem asks for entry of %&'

    7ession

    7ystem reects an

    unreadable card

    7ystem is on and

    not servicing acustomer

    &nsert an

    unreadable card

    /ard is eected67ystem displays an error

    screen67ystem is ready to start anew session

    7ession7ystem acceptscustomer#s %&'

    7ystem is askingfor entry of %&'

    3nter a %&'7ystem displays a menu oftransaction types

    7ession7ystem allowscustomer to performa transaction

    7ystem isdisplaying menuof transactiontypes

    %erform atransaction

    7ystem asks whethercustomer wants anothertransaction

    7ession

    7ystem allows

    multipletransactions in onesession

    7ystem is askingwhether

    customer wantsanothertransaction

    Answer yes 7ystem displays a menu oftransaction types

    7ession

    7ession ends whencustomer choosesnot to do anothertransaction

    7ystem is askingwhethercustomer wantsanothertransaction

    Answer no7ystem eects card and isready to start a new session

    Transaction&ndividual types oftransaction will betested below

    Transaction7ystem handles aninvalid %&'properly

    A readable cardhas been entered

    3nter an incorrect%&' and thenattempt atransaction

    The &nvalid %&' 3tension isperformed

    ithdrawal

    7ystem askscustomer to choosean account towithdraw from

    Menu oftransaction typesis beingdisplayed

    /hooseithdrawaltransaction

    7ystem displays a menu ofaccount types

    ithdrawal 7ystem askscustomer to choose

    Menu of accounttypes is being

    /hoose checkingaccount

    7ystem displays a menu ofpossible withdrawal amounts

  • 7/25/2019 Test Cases for Atm System

    7/26

    Use Case$unction %ein&

    Tested

    nitial System

    Statenput Expected 'utput

    7ystem7tartup

    7ystem is startedwhen the switch isturned 1on1

    7ystem is offActivate the 1on1switch

    7ystem reuests initial cashamount

    a dollar amount towithdraw

    displayed

    ithdrawal

    7ystem performs alegitimatewithdrawaltransaction properly

    7ystem isdisplaying themenu ofwithdrawalamounts

    /hoose anamount that thesystem currentlyhas and which isnot greater thanthe accountbalance

    7ystem dispenses thisamount of cash67ystem prints a correctreceipt showing amount andcorrect updated balance67ystem records transactioncorrectly in the log (showingboth message to the bankand approval back)

    ithdrawal

    7ystem verifies thatit has sufficient cashon hand to fulfillthe reuest

    7ystem has beenstarted up with

    less than themaimumwithdrawalamount in cashon hand67ystem isreuesting awithdrawalamount

    /hoose anamount greaterthan what thesystem currentlyhas

    7ystem displays anappropriate message andasks customer to choose adifferent amount

    ithdrawal

    7ystem verifies that

    customer#s balanceis sufficient tofulfill the reuest

    7ystem is

    reuesting awithdrawalammount

    /hoose anamount that the

    system currentlyhas but which isgreater than theaccount balance

    7ystem displays anappropriate message and

    offers customer the option ofchoosing to do anothertransaction or not"

    ithdrawal

    A withdrawaltransaction can becancelled by thecustomer any timeprior to choosingthe dollar amount

    7ystem isdisplaying menuof account types

    %ress 1/ancel1key

    7ystem displays anappropriate message andoffers customer the option ofchoosing to do anothertransaction or not"

    ithdrawal

    A withdrawal

    transaction can becancelled by thecustomer any timeprior to choosingthe dollar amount

    7ystem isdisplaying menuof dollaramounts

    %ress 1/ancel1key

    7ystem displays anappropriate message andoffers customer the option ofchoosing to do anothertransaction or not"

    :eposit

    7ystem askscustomer to choosean account todeposit to

    Menu oftransaction typesis beingdisplayed

    /hoose :eposittransaction

    7ystem displays a menu ofaccount types

    :eposit 7ystem asks Menu of account /hoose checking 7ystem displays a reuest for

  • 7/25/2019 Test Cases for Atm System

    8/26

    Use Case$unction %ein&

    Tested

    nitial System

    Statenput Expected 'utput

    7ystem7tartup

    7ystem is startedwhen the switch isturned 1on1

    7ystem is offActivate the 1on1switch

    7ystem reuests initial cashamount

    customer to enter adollar amount todeposit

    types is beingdisplayed

    accountthe customer to type a dollaramount

    :eposit7ystem askscustomer to insertan envelope

    7ystem isdisplaying areuest for thecustomer to typea dollar amount

    3nter a legitimatedollar amount

    7ystem reuests thatcustomer insert an envelope

    :eposit7ystem performs alegitimate deposit

    transaction properly

    7ystem isreuesting thatcustomer insert

    an envelope

    &nsert an envelope

    7ystem accepts envelope67ystem prints a correctreceipt showing amount andcorrect updated balance67ystem records transaction

    correctly in the log (showingmessage to the bank,approval back, andacceptance of the envelope)

    :eposit

    A deposittransaction can becancelled by thecustomer any timeprior to inserting anenvelope

    7ystem isdisplaying menuof account types

    %ress 1/ancel1key

    7ystem displays anappropriate message andoffers customer the option ofchoosing to do anothertransaction or not"

    :eposit

    A deposit

    transaction can becancelled by thecustomer any timeprior to inserting anenvelope

    7ystem isreuestingcustomer to entera dollar amount

    %ress 1/ancel1key

    7ystem displays an

    appropriate message andoffers customer the option ofchoosing to do anothertransaction or not"

    :eposit

    A deposittransaction can becancelled by thecustomer any timeprior to inserting anenvelope

    7ystem isreuestingcustomer toinsert anenvelope

    %ress 1/ancel1key

    7ystem displays anappropriate message andoffers customer the option ofchoosing to do anothertransaction or not"

    :eposit

    A deposittransaction iscancelledautomatically if anenvelope is notinserted within areasonable time

    7ystem isreuestingcustomer toinsert anenvelope

    ait for thereuest to timeout

    7ystem displays anappropriate message andoffers customer the option ofchoosing to do anothertransaction or not"

    Transfer 7ystem askscustomer to choosean account to

    Menu oftransaction typesis being

    /hoose Transfertransaction

    7ystem displays a menu ofaccount types specifyingtransfer from

  • 7/25/2019 Test Cases for Atm System

    9/26

    Use Case$unction %ein&

    Tested

    nitial System

    Statenput Expected 'utput

    7ystem7tartup

    7ystem is startedwhen the switch isturned 1on1

    7ystem is offActivate the 1on1switch

    7ystem reuests initial cashamount

    transfer from displayed

    Transfer

    7ystem asks

    customer to choosean account totransfer to

    Menu of account

    types to transferfrom is beingdisplayed

    /hoose checkingaccount

    7ystem displays a menu of

    account types specifyingtransfer to

    Transfer

    7ystem askscustomer to enter adollar amount totransfer

    Menu of accounttypes to transferto is beingdisplayed

    /hoose savingsaccount

    7ystem displays a reuest forthe customer to type a dollaramount

    Transfer7ystem performs alegitimate transfer

    transaction properly

    7ystem isdisplaying areuest for the

    customer to typea dollar amount

    3nter a legitimatedollar amount

    7ystem prints a correctreceipt showing amount andcorrect updated balance67ystem records transaction

    correctly in the log (showingboth message to the bankand approval back)

    Transfer

    A transfertransaction can becancelled by thecustomer any timeprior to enteringdollar amount

    7ystem isdisplaying menuof account typesspecifyingtransfer from

    %ress 1/ancel1key

    7ystem displays anappropriate message andoffers customer the option ofchoosing to do anothertransaction or not"

    Transfer

    A transfertransaction can be

    cancelled by thecustomer any timeprior to enteringdollar amount

    7ystem isdisplaying menuof account typesspecifyingtransfer to

    %ress 1/ancel1key

    7ystem displays anappropriate message andoffers customer the option ofchoosing to do anothertransaction or not"

    Transfer

    A transfertransaction can becancelled by thecustomer any timeprior to enteringdollar amount

    7ystem isreuestingcustomer to entera dollar amount

    %ress 1/ancel1key

    7ystem displays anappropriate message andoffers customer the option ofchoosing to do anothertransaction or not"

    &nuiry

    7ystem asks

    customer to choosean account toinuire about

    Menu of

    transaction typesis beingdisplayed

    /hoose &nuirytransaction

    7ystem displays a menu ofaccount types

    &nuiry7ystem performs alegitimate inuirytransaction properly

    7ystem isdisplaying menuof account types

    /hoose checkingaccount

    7ystem prints a correctreceipt showing correctbalance67ystem records transactioncorrectly in the log (showingboth message to the bankand approval back)

  • 7/25/2019 Test Cases for Atm System

    10/26

    Use Case$unction %ein&

    Tested

    nitial System

    Statenput Expected 'utput

    7ystem7tartup

    7ystem is startedwhen the switch isturned 1on1

    7ystem is offActivate the 1on1switch

    7ystem reuests initial cashamount

    &nuiry

    An inuirytransaction can becancelled by thecustomer any timeprior to choosing anaccount

    7ystem is

    displaying menuof account types

    %ress 1/ancel1key

    7ystem displays anappropriate message and

    offers customer the option ofchoosing to do anothertransaction or not"

    &nvalid %&'3tension

    /ustomer is askedto reenter %&'

    3nter an incorrect%&'6Attempt aninuirytransaction on thecustomer#schecking account

    /ustomer is asked to re!enter%&'

    &nvalid %&'3tension

    /orrect re!entry of%&' is accepted

    ;euest to re!enter %&' isbeing displayed

    3nter correct %&' 0riginal transactioncompletes successfully

    &nvalid %&'3tension

    A correctly re!entered %&' is usedfor subseuenttransactions

    An incorrect %&'has been re!entered andtransactioncompletednormally

    %erform anothertransaction

    This transaction completessuccessfully as well

    &nvalid %&'3tension

    &ncorrect re!entry of%&' is not accepted

    ;euest to re!enter %&' is

    being displayed

    3nter incorrect%&'

    An appropriate message isdisplayed and re!entry of the

    %&' is again reuested

    &nvalid %&'3tension

    /orrect re!entry of%&' on the secondtry is accepted

    ;euest to re!enter %&' isbeing displayed

    3nter incorrect%&' the first time,then correct %&'the second time

    0riginal transactioncompletes successfully

    &nvalid %&'3tension

    /orrect re!entry of%&' on the third tryis accepted

    ;euest to re!enter %&' isbeing displayed

    3nter incorrect%&' the first timeand second times,then correct %&'the third time

    0riginal transactioncompletes successfully

    &nvalid %&'3tension

    Three incorrect re!

    entries of %&' resultin retaining cardand abortingtransaction

    ;euest to re!enter %&' isbeing displayed

    3nter incorrect%&' three times

    An appropriate message isdisplayed6/ard is retained by machine67ession is terminated

    Analysis Classes

    An initial reading of the use cases suggests that the following will be part of the system"

  • 7/25/2019 Test Cases for Atm System

    11/26

    A controller obect representing the ATM itself (managing the boundary obects

    listed below")

    4oundary obects representing the individual component parts of the ATM*

    o 0perator panel"

    o /ard reader"

    o /ustomer console, consisting of a display and keyboard"

    o 'etwork connection to the bank"o /ash dispenser"

    o 3nvelope acceptor"

    o ;eceipt printer"

    /ontroller obects corresponding to use cases" ('ote* class ATM can handle the

    7tartup and 7hutdown use cases itself, so these do not give rise to separate obectshere")7essiono Transaction (abstract generali

  • 7/25/2019 Test Cases for Atm System

    12/26

    o /lass 7ession

    o /lass Transaction

    o /lass ithdrawal

    o /lass :eposit

    o /lass Transfer

    o /lass &nuiry

    3ntity obects found necessary when assigning responsibilities to other obects

    o /lass 4alanceso /lass /ard

    o /lass Message

    o /lass ;eceipt

    o /lass 7tatus

    Class ATM

    Responsi(ilities Colla(orators

    7tart up when switch is turned on 0perator%anel/ash:ispenser'etworkTo4ank

    7hut down when switch is turned off 'etworkTo4ank

    7tart a new session when card is inserted by customer /ustomer/onsole7ession

    %rovide access to component parts for sessions andtransactions

    Class Card Reader

    Responsi(ilities Colla(orators

    Tell ATM when card is inserted ATM

    ;ead information from card /ard

    3ect card

    ;etain card

    Class Cash Dispenser

    Responsi(ilities Colla(orators

    >eep track of cash on hand, starting with initial amount

    ;eport whether enough cash is available

    :ispense cash 5og

    Class Customer Console

    Responsi(ilities Colla(orators

    :isplay a message

    :isplay a prompt, accept a %&' from keyboard

    :isplay a prompt and menu, accept a choice from keyboard

    :isplay a prompt, accept a dollar amount from keyboard

    ;espond to cancel key being pressed by customer

    http://courses.knox.edu/cs292/ATMExample/CRCCards.html#Sessionhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Transactionhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Withdrawalhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Deposithttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Transferhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Inquiryhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Balanceshttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Cardhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Statushttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#OperatorPanelhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CashDispenserhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CashDispenserhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#NetworkToBankhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#NetworkToBankhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Sessionhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#ATMhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Cardhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Loghttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Sessionhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Transactionhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Withdrawalhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Deposithttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Transferhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Inquiryhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Balanceshttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Cardhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Statushttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#OperatorPanelhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CashDispenserhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#NetworkToBankhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#NetworkToBankhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Sessionhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#ATMhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Cardhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Log
  • 7/25/2019 Test Cases for Atm System

    13/26

    Class Envelope Acceptor

    Responsi(ilities Colla(orators

    Accept envelope from customer6 report if timed out orcancelled

    5og

    Class Log

    Responsi(ilities Colla(orators

    5og messages sent to bank5og responses from bank

    5og dispensing of cash

    5og receiving an envelope

    Class etwor!To"an!

    Responsi(ilities Colla(orators

    &nitiate connection to bank at startup

    7end message to bank and wait for response Message5og

    4alances7tatus

    Terminate connection to bank at shutdown

    Class #perator $anel

    Responsi(ilities Colla(orators

    &nform ATM of changes to state of switch ATM

    Allow operator to specify amount of initial cash

    Class Receipt $rinter

    Responsi(ilities Colla(orators

    %rint receipt ;eceipt

    Class %ession

    Responsi(ilities Colla(orators

    %erform session use case ATM/ard;eader/ard/ustomer/onsoleTransaction

    =pdate %&' value if customer has to re!enter it

    A&stract Class Transaction

    Responsi(ilities Colla(orators

    Allow customer to choose a type of transaction ATM/ustomer/onsoleithdrawal:epositTransfer&nuiry

    http://courses.knox.edu/cs292/ATMExample/CRCCards.html#Loghttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Loghttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Balanceshttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Statushttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#ATMhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#ATMhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CardReaderhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Cardhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Transactionhttp://courses.knox.edu/cs292/ATMExample/ATMhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Withdrawalhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Withdrawalhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Deposithttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Transferhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Inquiryhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Loghttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Loghttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Balanceshttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Statushttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#ATMhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#ATMhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CardReaderhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Cardhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Transactionhttp://courses.knox.edu/cs292/ATMExample/ATMhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Withdrawalhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Deposithttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Transferhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Inquiry
  • 7/25/2019 Test Cases for Atm System

    14/26

    %erform Transaction =se /ase ATM/ustomer/onsoleithdrawal:epositTransfer&nuiryMessage'etworkTo4ank

    ;eceipt;eceipt%rinter

    %erform invalid %&' etension /ustomer/onsole7ession/ard;eader

    Class 'ithdrawal

    Responsi(ilities Colla(orators

    %erform operations peculiar to withdrawal transaction use case /ustomer/onsole/ash:ispenserMessage;eceipt

    Class Deposit

    Responsi(ilities Colla(orators

    %erform operations peculiar to deposit transaction use case /ustomer/onsoleMessage3nvelopeAcceptor

    ;eceipt

    Class Transfer

    Responsi(ilities Colla(orators

    %erform operations peculiar to transfer transaction use case /ustomer/onsoleMessage;eceipt

    Class In(uir)Responsi(ilities Colla(orators

    %erform operations peculiar to inuiry transaction use case /ustomer/onsoleMessage;eceipt

    Class "alances

    Responsi(ilities Colla(orators

    ;epresent account balance information returned by bank

    http://courses.knox.edu/cs292/ATMExample/CRCCards.html#ATMhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Withdrawalhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Withdrawalhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Deposithttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Transferhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Inquiryhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#NetworkToBankhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#ReceiptPrinterhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Sessionhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CardReaderhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CashDispenserhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CashDispenserhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#EnvelopeAcceptorhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#ATMhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Withdrawalhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Deposithttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Transferhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Inquiryhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#NetworkToBankhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#ReceiptPrinterhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Sessionhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CardReaderhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CashDispenserhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#EnvelopeAcceptorhttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipthttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Messagehttp://courses.knox.edu/cs292/ATMExample/CRCCards.html#Receipt
  • 7/25/2019 Test Cases for Atm System

    15/26

    Class Card

    Responsi(ilities Colla(orators

    ;epresent information encoded on customer#s ATM card

    Class Message

    Responsi(ilities Colla(orators

    ;epresent information to be sent over network to bank

    Class Receipt

    Responsi(ilities Colla(orators

    ;epresent information to be printed on a receipt

    Class %tatus

    Responsi(ilities Colla(orators

    ;epresent transaction status information returned by bank

    Class Dia&ram for Example ATM System

    7hown below is the class diagram for the ATM system" The basic structure of the classdiagram arises from the responsibilities and relationships discovered when doing the/;/ cards and &nteraction :iagrams" (&f a class uses another class as a collaborator, orsends a message to an obect of that class during an &nteraction, then there must either bean association linking obects of those classes, or linking the 1sending1 class to an obectwhich provides access to an obect of the 1receiving1 class")

    &n the case of the ATM system, one of the responsibilities of the ATM is to provide accessto its component parts for 7ession and Transaction obects6 thus, 7ession and Transactionhave associations to ATM, which in turn has associations to the classes representing theindividual component parts" (3plicit 1uses1 links between 7ession and Transaction, onthe one hand, and the component parts of the ATM, on the other hand, have been omittedfrom the diagram to avoid making it ecessively cluttered")

    The need for the various classes in the diagram was discovered at various points in thedesign process"

    7ome classes were discovered when doing analysis (see the Analysis /lass

    :iagramdeveloped earlier")

    7ome classes were discovered when doing /;/ cards

    http://courses.knox.edu/cs292/ATMExample/AnalysisClasses.htmlhttp://courses.knox.edu/cs292/ATMExample/AnalysisClasses.htmlhttp://courses.knox.edu/cs292/ATMExample/AnalysisClasses.htmlhttp://courses.knox.edu/cs292/ATMExample/AnalysisClasses.html
  • 7/25/2019 Test Cases for Atm System

    16/26

    o Message ! used to represent a message to the bank"

    o ;eceipt ! used to encapsulate information to be printed on a receipt"

    o 7tatus ! used to represent return value from message to the bank"

    o 4alances ! used to record balance information returned by the bank"

    7ome classes were discovered when doing detailed design or writing code

    o Money ! used to represent money amounts, in numerous places"

    o Account&nformation ! contains names of various types of accounts

    customer can choose from

    That is, 00 design is not a 1waterfall1 process ! discoveries made when doing detaileddesign and coding can impact overall system design"

    To prevent the diagram from becoming overly large, only the name of each class isshown ! the attribute and behavior 1compartments1 are shown in the detailed design, butare omitted here"

  • 7/25/2019 Test Cases for Atm System

    17/26

    Clic) on a class icon for lin)s to further information a(out it

  • 7/25/2019 Test Cases for Atm System

    18/26

    Detailed Desi&n

    A maor task of detailed design is to spell out, in detail, the attributes and methods neededby each class (the second and third 1compartments1 of the representation for each class ina class diagram")

    The methods needed by each class are implicit in the responsibilities assigned to the classin the /;/ cards, and become eplicit in the &nteraction :iagrams" A responsibility listedfor a class on its /;/ card generally maps into a method or methods in the detailed

  • 7/25/2019 Test Cases for Atm System

    19/26

    design" 5ikewise, any time an obect belonging to a given class is shown as the recipientof a message in either a 7euence or /ollaboration :iagram, the class needs acorresponding method" Many of the needed attributes are also either eplicitly orimplicitly present in the diagrams6 the need for others becomes evident as the code for theclass is being written" (Thus detailed design and coding are a 1round trip1 process !detailed design dictates coding, and coding leads to elaboration of the detailed design")

    &n designing this system, a few key design decisions were made*

    The class ATM is made an active class ! that is, the ATM obect has its own

    thread" =sing the ?ava thread facllity leads to defining a run() method in this classwhose body is eecuted by the ATM#s thread" The fact that class ATM is active isindicated in class diagrams by enclosing it in a heavier outline"

    /ertain signals initiate computation ! e"g" the signals from the operator console

    when the state of the switch is changed, or from the card reader when a card isinserted" &n the @=& simulation of the ATM, these signals are sent by the1action%erformed()1 method of the appropriate @=& button6 in a real ATM theywould be sent by the physical components themselves, which might then also

    need to be active classes" ('ote* this forms an eception to the rule that aresponsibility on a /;/ card translates into a method in the design ! in this casethe class sends a signal, rather than receiving it, so it does not need a methoddirectly corresponding to the responsibility")

    The Transaction hierarchy consists of the abstract class Transaction and four

    concrete subclasses (ithdrawal, :eposit, Transfer and &nuiry)" The classTransaction has a 1virtual constructor1 called makeTransaction() which asks thecustomer to choose a transaction type and then constructs and returns an obect ofthe appropriate subclass" The Transaction class is made responsible for carryingout the Transaction use case and the &nvalid %&' etension6 for the former, it

    makes use of abstract methods get7pecificsrom/ustomer() andcompleteTransaction() which are implemented concretely by each subclass"

    The class ;eceipt is abstract" The completeTransaction() method of each kind of

    transaction creates a concrete instance that contains the information relevant tothat kind of transaction"

    The class 7tatus is abstract" The send() method of 'etworkTo4ank constructs a

    concrete instance that contains the information appropriate to the responsereceived from the bank to a particular message"

    &n the design below, each class is developed in isolation" 'o attempt is made to connecteach class to related classes as in the class diagram, because the resulting picture wouldnot fit on a displayable web page" Therefore, this detailed design should be viewed inconunction with the /lass :iagramdeveloped earlier"

    :etailed design for class ATM

    /omponent parts of the ATM

    o :etailed design for class /ard;eader

    http://courses.knox.edu/cs292/ATMExample/ClassDiagram.htmlhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#ATMhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#CardReaderhttp://courses.knox.edu/cs292/ATMExample/ClassDiagram.htmlhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#ATMhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#CardReader
  • 7/25/2019 Test Cases for Atm System

    20/26

    o :etailed design for class /ash:ispenser

    o :etailed design for class /ustomer/onsole

    o :etailed design for class 3nvelopeAcceptor

    o :etailed design for class 5og

    o :etailed design for class 'etworkTo4ank

    o :etailed design for class 0perator%anel

    o :etailed design for class ;eceipt%rinter

    :etailed design for class 7ession

    The Transaction class hierarchy

    o :etailed design for class Transaction

    o :etailed design for class ithdrawal

    o :etailed design for class :eposit

    o :etailed design for class Transfer

    o :etailed design for class &nuiry

    /lasses representing banking concepts, used by the above

    o :etailed design for class Account&nformation

    o :etailed design for class 4alances

    o :etailed design for class /ard

    o :etailed design for class Message

    o :etailed design for class Money

    o

    :etailed design for class ;eceipto :etailed design for class 7tatus

    ATM

    ! id* int

    ! place* 7tring

    ! bank'ame* 7tring

    ! bankAddress* &netAddress

    ! card;eader* /ard;eader

    ! cash:ispenser* /ash:ispenser

    ! customer/onsole* /ustomer/onsole

    ! envelopeAcceptor* 3nvelopeAcceptor

    ! log* 5og

    ! networkTo4ank* 'etworkTo4ank

    ! operator%anel* 0perator%anel

    ! receipt%rinter* ;eceipt%rinter

    http://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#CashDispenserhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#EnvelopeAcceptorhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Loghttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#NetworkToBankhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#OperatorPanelhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#ReceiptPrinterhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Sessionhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Transactionhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Withdrawalhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Deposithttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Transferhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Inquiryhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#AccountInformationhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Balanceshttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Cardhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Messagehttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Moneyhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Receipthttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Statushttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#CashDispenserhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#CustomerConsolehttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#EnvelopeAcceptorhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Loghttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#NetworkToBankhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#OperatorPanelhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#ReceiptPrinterhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Sessionhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Transactionhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Withdrawalhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Deposithttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Transferhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Inquiryhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#AccountInformationhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Balanceshttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Cardhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Messagehttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Moneyhttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Receipthttp://courses.knox.edu/cs292/ATMExample/DetailedDesign.html#Status
  • 7/25/2019 Test Cases for Atm System

    21/26

    ! state* int

    ! switch0n* boolean

    ! card&nserted* boolean

    ! 0B7TAT3* final int

    ! &:53B7TAT3* final int

    ! 73;9&'@B/=7T0M3;B7TAT3* final int

    C ATM(id* int, place* 7tring, bank'ame* 7tring, bankAddress* &netAddress)C run()

    C switch0n()

    C switch0ff

    C card&nserted()

    C get&:()* int

    C get%lace()* 7tring

    C get4ank'ame()* 7tring

    C get/ard;eader()* /ard;eader

    C get/ash:ispenser()* /ash:ispenser

    C get/ustomer/onsole()* /ustomer/onsole

    C get3nvelopeAcceptor()* 3nvelopeAcceptor

    C get5og()* 5og

    C get'etworkTo4ank()* 'etworkTo4ank

    C get0perator%anel()* 0perator%anel

    C get;eceipt%rinter()* ;eceipt%rinter

    ! perform7tartup()

    ! perform7hutdown()

    CardReader

    ! atm* ATM

    C /ard;eader(atm* ATM)

    C read/ard()* /ard

    C eect/ard()

    C retain/ard()

    CashDispenser

    ! log* 5og

    ! cash0n8and* Money

    C /ash:ispenser(log* 5og)

    C set&nitial/ash(initial/ash* Money)

    C check/ash0n8and(amount* Money)* boolean

    C dispense/ash(amount* Money)

  • 7/25/2019 Test Cases for Atm System

    22/26

    CustomerConsole

    C /ustomer/onsole()

    C display(message* 7tring)

    C read%&'(prompt* 7tring)* int throws /ancelled

    C readMenu/hoice(prompt* 7tring, menu* 7tring DE)* int throws /ancelled

    C readAmount(prompt* 7tring)* Money throws /ancelledEn!elopeAcceptor

    ! log* 5og

    C 3nvelopeAcceptor(log* 5og)

    C accept3nvelope() throws /ancelled

    *o&

    C 5og()

    C log7end(message* Message)

    C log;esponse(status* 7tatus)

    C log/ash:ispensed(amount* Money)

    C log3nvelopeAccepted()

    #etwor)To%an)

    ! log* 5og

    ! bankAddress* &netAddress

    C 'etworkTo4ank(log* 5og, bankAddress* &netAddress)

    C open/onnection()

    C close/onnection()

    C sendMessage(message* Message, out balances* 4alances)* 7tatus

    'perator"anel

    ! atm* ATM

    C 0perator%anel(atm* ATM)

    C get&nitial/ash()* MoneyReceipt"rinter

    C ;eceipt%rinter()

    C print;eceipt(receipt* ;eceipt)

    Session

    ! atm* ATM

    ! pin* int

  • 7/25/2019 Test Cases for Atm System

    23/26

    ! state* int

    ! ;3A:&'@B/A;:B7TAT3* final int

    ! ;3A:&'@B%&'B7TAT3* final int

    ! /8007&'@BT;A'7A/T&0'B7TAT3* final int

    ! %3;0;M&'@BT;A'7A/T&0'B7TAT3* final int

    ! 3?3/T&'@B/A;:B7TAT3* final int

    ! &'A5B7TAT3* final int

    C 7ession(atm* ATM)F

    C perform7ession()

    C set%&'(int pin)

    Transaction

    G atm* ATM

    G session* 7ession

    G card* /ard

    G pin* int

    G serial'umber* int

    G message* Message

    G balances* 4alances

    ! T;A'7A/T&0'BTH%37BM3'=* final 7tring DE

    ! net7erial'umber* int

    ! state* int

    ! @3TT&'@B7%3/&&/7B7TAT3* final int

    ! 73':&'@BT0B4A'>B7TAT3* final int

    ! &'9A5&:B%&'B7TAT3* final int

    ! /0M%53T&'@BT;A'7A/T&0'B7TAT3* final int

    ! %;&'T&'@B;3/3&%TB7TAT3* final int

    ! A7>&'@B:0BA'0T83;B7TAT3* final int

    G Transaction(atm* ATM, session* 7ession, card* /ard, pin* int)

    C makeTransaction(atm* ATM, session* 7ession, card* /ard, pin* int)* Transaction throws/ancelled

    C performTransaction()* boolean throws /ard;etained

    C perform&nvalid%in3tension()* 7tatus throws /ancelled, /ard;etained

    C get7erial'umber()* int

    Gget!pecifics"rom#ustomer(: $essage throws #ancelled

    G completeTransaction(: %eceipt throws #ancelled

    Withdrawal

    ! from* int

    ! amount* Money

    C ithdrawal(atm* ATM, session* 7ession, card* /ard, pin* int)

    G get7pecificsrom/ustomer()* Message throws /ancelled

    G completeTransaction()* ;eceipt

  • 7/25/2019 Test Cases for Atm System

    24/26

    Deposit

    ! to* int

    ! amount* Money

    C :eposit(atm* ATM, session* 7ession, card* /ard, pin* int)

    G get7pecificsrom/ustomer()* Message throws /ancelled

    G completeTransaction()* ;eceipt throws /ancelledTransfer

    ! from* int

    ! to* int

    ! amount* Money

    C Transfer(atm* ATM, session* 7ession, card* /ard, pin* int)

    G get7pecificsrom/ustomer()* Message throws /ancelled

    G completeTransaction()* ;eceipt

    nquiry

    ! from* int

    C &nuiry(atm* ATM, session* 7ession, card* /ard, pin* int)

    G get7pecificsrom/ustomer()* Message throws /ancelled

    G completeTransaction()* ;eceipt

    Accountnformation

    C A//0='TB'AM37* final 7tringDE

    C A//0='TBA44;39&AT&0'7* final 7tring DE

    %alances

    ! total* Money

    ! available* Money

    C 4alances()

    C set4alances(total* Money, available* Money)

    C getTotal()* MoneyC getAvailable()* Money

    Card

    ! number* int

    C /ard(number* int)

    C get'umber()* int

    Messa&e

  • 7/25/2019 Test Cases for Atm System

    25/26

    C &T8:;AA5* final int

    C &'&T&AT3B:3%07&T* final int

    C /0M%53T3B:3%07&T* final int

    C T;A'73;* final int

    C &'I=&;H* final int

    ! message/ode* int

    ! card* /ard

    ! pin* int! serial'umber* int

    ! fromAccount* int

    ! toAccount* int

    ! amount* int

    C Message(message/ode* int, card'umber* /ard, pin* int, serial'umber* int,fromAccount* int, toAccount* int, amount* Money)

    C to7tring()* 7tring

    C set%&'(pin* int)

    C getMessage/ode()* intC get/ard()* /ard

    C get%&'()* int

    C get7erial'umber()* int

    C getromAccount()* int

    C getToAccount()* int

    C getAmount()* Money

    Money

    ! cents* long

    C Money(dollars* int)

    C Money(dollars* int, cents* int)

    C Money(to/opy* Money)

    C to7tring()* 7tring

    C add(amountToAdd* Money)

    C subtract(amountTo7ubtract* Money)

    C less3ual(compareTo* Money)* boolean

    Receipt

    ! heading%ortion* 7tring DE

    G details%ortion()* 7tring DE

    ! balances%ortion* 7tring DE

    G ;eceipt(atm* ATM, card* /ard, transaction* Transaction, balances* 4alances)

    C get5ines()* 3numeration

    Status

  • 7/25/2019 Test Cases for Atm System

    26/26

    C to7tring()* 7tring

    C is!uccess(: boolean

    C is&nvalid'&N(: boolean

    Cget$essage(: !tring