We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byRebecca Wilcox
Modified over 4 years ago
Introduction to Software Testing Chapter 2.6 Graph Coverage for Use Cases Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/softwaretest/
Introduction to Software Testing (Ch 2) © Ammann & Offutt 2 UML Use Cases n UML use cases are often used to express software requirements n They help express computer application workflow n We won’t teach use cases, but show examples
Introduction to Software Testing (Ch 2) © Ammann & Offutt 3 Simple Use Case Example n Actors : Humans or software components that use the software being modeled n Use cases : Shown as circles or ovals n Node Coverage : Try each use case once … Withdraw Funds Get Balance Transfer Funds ATM User Use Case graphs, by themselves, are not useful for testing
Introduction to Software Testing (Ch 2) © Ammann & Offutt 4 Elaboration n Use cases are commonly elaborated (or documented) n Elaboration is first written textually –Details of operation –Alternatives model choices and conditions during execution
Elaboration of ATM Use Case n Use Case Name : Withdraw Funds n Summary : Customer uses a valid card to withdraw funds from a valid bank account. n Actor : ATM Customer n Precondition : ATM is displaying the idle welcome message n Description : –Customer inserts an ATM Card into the ATM Card Reader. –If the system can recognize the card, it reads the card number. –System prompts the customer for a PIN. –Customer enters PIN. –System checks the card’s expiration date and whether the card has been stolen or lost. –If the card is valid, the system checks if the entered PIN matches the card PIN. –If the PINs match, the system finds out what accounts the card can access. –System displays customer accounts and prompts the customer to choose a type of transaction. There are three types of transactions, Withdraw Funds, Get Balance and Transfer Funds. (The previous eight steps are part of all three use cases; the following steps are unique to the Withdraw Funds use case.) Introduction to Software Testing (Ch 2) © Ammann & Offutt 5
Elaboration of ATM Use Case —(2/3) n Description (continued) : –Customer selects Withdraw Funds, selects the account number, and enters the amount. –System checks that the account is valid, makes sure that customer has enough funds in the account, makes sure that the daily limit has not been exceeded, and checks that the ATM has enough funds. –If all four checks are successful, the system dispenses the cash. –System prints a receipt with a transaction number, the transaction type, the amount withdrawn, and the new account balance. –System ejects card. –System displays the idle welcome message. Introduction to Software Testing (Ch 2) © Ammann & Offutt 6
Elaboration of ATM Use Case —(3/3) n Alternatives : –If the system cannot recognize the card, it is ejected and the welcome message is displayed. –If the current date is past the card's expiration date, the card is confiscated and the welcome message is displayed. –If the card has been reported lost or stolen, it is confiscated and the welcome message is displayed. –If the customer entered PIN does not match the PIN for the card, the system prompts for a new PIN. –If the customer enters an incorrect PIN three times, the card is confiscated and the welcome message is displayed. –If the account number entered by the user is invalid, the system displays an error message, ejects the card and the welcome message is displayed. –If the request for withdraw exceeds the maximum allowable daily withdrawal amount, the system displays an apology message, ejects the card and the welcome message is displayed. –If the request for withdraw exceeds the amount of funds in the ATM, the system displays an apology message, ejects the card and the welcome message is displayed. –If the customer enters Cancel, the system cancels the transaction, ejects the card and the welcome message is displayed. n Postcondition : –Funds have been withdrawn from the customer’s account. Introduction to Software Testing (Ch 2) © Ammann & Offutt 7
Introduction to Software Testing (Ch 2) © Ammann & Offutt 8 Wait A Minute … n What does this have to do with testing ? n Specifically, what does this have to do with graphs ??? n Remember our admonition : Find a graph, then cover it! n Beizer suggested “Transaction Flow Graphs” in his book n UML has something very similar : Activity Diagrams
Introduction to Software Testing (Ch 2) © Ammann & Offutt 9 Use Cases to Activity Diagrams n Activity diagrams indicate flow among activities n Activities should model user level steps n Two kinds of nodes: –Action states –Sequential branches n Use case descriptions become action state nodes in the activity diagram n Alternatives are sequential branch nodes n Flow among steps are edges n Activity diagrams usually have some helpful characteristics: –Few loops –Simple predicates –No obvious DU pairs
Introduction to Software Testing (Ch 2) © Ammann & Offutt 10 ATM Withdraw Activity Graph
Introduction to Software Testing (Ch 2) © Ammann & Offutt 11 Covering Activity Graphs n Node Coverage –Inputs to the software are derived from labels on nodes and predicates –Used to form test case values n Edge Coverage n Data flow techniques do not apply n Scenario Testing –Scenario : A complete path through a use case activity graph –Should make semantic sense to the users –Number of paths often finite –If not, scenarios defined based on domain knowledge –Use “specified path coverage”, where the set S of paths is the set of scenarios –Note that specified path coverage does not necessarily subsume edge coverage, but scenarios should be defined so that it does
Summary of Use Case Testing n Use cases are defined at the requirements level n Can be very high level n UML Activity Diagrams encode use cases in graphs –Graphs usually have a fairly simple structure n Requirements-based testing can use graph coverage –Straightforward to do by hand –Specified path coverage makes sense for these graphs Introduction to Software Testing (Ch 2) © Ammann & Offutt 12
Chapter 4: Requirements Engineering
Withdrawal Transaction Use Case Primary Actor: Customer Pre-conditions: The customer must have a valid ATM card and PIN. Post-conditions: The customer.
Use Case Diagrams Damian Gordon.
Use Case & Use Case Diagram
Introduction to Software Testing Chapter 1 Paul Ammann & Jeff Offutt SUMMARY OF PARTS 1 AND 2 FROM LAST WEEK.
Lecture 10 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
1COM6030 Systems Analysis and Design © University of Sheffield 2005 COM 6030 Software Analysis and Design Lecture 7 – More on use cases and activity diagrams.
Use Case Modeling SJTU. Unified Modeling Language (UML) l Standardized notation for object-oriented development l Needs to be used with an analysis and.
USE CASE – ATM EXAMPLE Actors: ATM Customer ATM Operator Use Cases: The customer can withdraw funds from a checking or savings account query the balance.
SWE 214 (071) Use Case Diagrams Slide 1 Use Case Diagrams Examples.
ATM Case Study A Discussion.
Extending the Requirements Model - techniques for detailing use cases
CPSC 333: Foundations of Software EngineeringJ. Denzinger Small Test: Bank account manager System has to run on an automated teller machine. User must.
Introduction to Software Testing Chapter 2.6 Graph Coverage for Use Cases Paul Ammann & Jeff Offutt
Lecture 8 Electronic Commerce Modelling Techniques
1 Chapter 4 Dynamic Modeling and Analysis (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
Sequence Diagrams. Introduction A Sequence diagram depicts the sequence of actions that occur in a system. The invocation of methods in each object, and.
CS3773 Software Engineering Lecture 03 UML Use Cases.
Software Modeling Jerry Lebowitz.
© 2019 SlidePlayer.com Inc. All rights reserved.