Arunkumar Khannur's Software Testing Knowledge Center
   
 

12.8. An Example on Creating STD and Designing Test Cases

STD describes the behavior of a class over time through illustrations of the states and transitions of a single object progressing through its lifetime. STD, in object-oriented systems, is a notational representation of behavior and also, response of an object to events, including internal and external stimuli.

We consider an example of an ATM of the bank to demonstrate the steps on creating corresponding STD and then using that STD to design test cases.

ATM problem statement: “User inserts the ATM card and ATM reads it. If card is correct the system shall allow the user to Balance Enquiry or Print Mini Statement or Withdraw Amount provided sufficient balance is available. In each of these possible actions, there can be displaying or printing messages.”

As a first step, we analyze the problem statement and try to understanding the system. When required we discuss with relevant stake holders to get clarifications on any points that may not be clear. By proceeding like this we develop an understanding of the problem. Following are the understanding of the problem after first round of analysis by involving stake holders:

Insert ATM Card
Read ATM Card.
Check : Valid Card?
Valid Card (“True”) Valid Card (“False”)
Enter PIN Number.
Check Valid PIN?
Eject Card
Valid PIN (“True”)
Display Main Menu
Valid PIN(“False”)
Check: Three Failures?
Idle
Select Transaction
Balance Enquiry or Print Mini Statement or Withdraw Amount
Failed for 3 times (“True”) Failed for 3 times (“False”)  
Balance Enquiry Print Mini Statement Withdraw Amount
Select Display and/or Print
Check : Adquate Balance?
Block Card Enter PIN Number.  
Select Display and/or Print Select Display and/or Print Adequate Balance (“True”) Adequate Balance (“False”) Eject Card    
Display and/or Print Display and/or Print Dispense Display and/or Print Idle    
Eject Card Eject Card Display and/or Print Eject Card      
Idle Idle Eject Card Idle      
    Idle        

As a second step, after analysis of the problem and developing an understanding, we Identify states, inputs and guards. Following that we create sa state model of the application. For the given example, following is the STD

At the end, we have to generate sequences of test actions.

Sequence State Input/Guard/Action Next State
S0001a Idle Insert Card Read Card
  Read Card Read Card Number, Bar Code, Validity Period. Check for Validity. If Invalid, Eject Card Idle
S0001b Idle Read Card Number, Bar Code, Validity Period. Check for Validity. If Valid, Accept Card Enter PIN
  Enter PIN Read PIN. If Invalid PIN Enter PIN
    Read PIN. If Invalid PIN is wrong 3 times, Block Card Idle
S0002a Enter PIN Read PIN. If valid PIN Select Transaction Type
S0002b Select Transaction Type If Balance Enquirry or Ministatement option selected Display Statement
  Display Statement If Print option not selected, Eject Card Idle
    If Print option selected Print Statmenet
  Print Statmenet Print Statement. Eject Card Idle
S0002c Select Transaction Type If Withdraw Amount option selected. Check for Adequate Amount. If Adequate Amount exists in account Dispense
  Dispense - Display Statement
  Display Statement - Print Statmenet
  Print Statmenet Print Statement. Eject Card Idle
S0002d Select Transaction Type If Withdraw Amount option selected. Check for Adequate Amount. If No Adequate Amount exists in account. Eject Card Idle
 
 
 
Khannur's Book
Arunkumar Khannur, Software Testing - Techniques and Applications, Published by Pearson Publications, 2011 (ISBN:978-81-317-5836-6; Pages:341 + xxii)
Follow Khannur
         
Khannur's Company
ISQT Process & Consulting Services Pvt. Ltd., Bangalore, INDIA
Khannur's Software Testing Forum
STEP-AUTO Forum
 Contact Khannur
ISQT Process & Consulting Services Pvt. Ltd.
#732, 1st Floor, 12th Main,
3rd Block, Rajajinagar,
Bangalore - 560010, INDIA
Phone: +91 80 23012511
URL: www.isqtinternational.com
Email: khannur@isqtinternational.com
Skype: arun.isqt