1 Software Testing and Quality Assurance Lecture 27 – Testing State Transition Diagrams.

Slides:



Advertisements
Similar presentations
Software Testing and Quality Assurance
Advertisements

Lecture 8: Testing, Verification and Validation
Verification and Validation
White Box and Black Box Testing Tor Stålhane. What is White Box testing White box testing is testing where we use the info available from the code of.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Programming Logic and Design Eighth Edition
1 Lecture 20 Sequential Circuits: Latches. 2 Overview °Circuits require memory to store intermediate data °Sequential circuits use a periodic signal to.
1 Software Engineering Lecture 11 Software Testing.
MIS 325 PSCJ. 2  Business processes can be quite complex  Process model: any abstract representation of a process  Process-modeling tools provide a.
Lecture 9 Descriptors, Events & Event Tables INFO1409 Systems Analysis & Design Module HND Year /9.
Software Engineering Introduction to UML.
Information System Engineering
Introduction to Software Testing Chapter 2.6 Graph Coverage for Use Cases Paul Ammann & Jeff Offutt
Testing dan Implementasi Sistem materi 4
Chapter 13 The Accounts Payable/ Cash Disbursement (AP/CD) Process
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Chapter 15 Design, Coding, and Testing. Copyright © 2005 Pearson Addison-Wesley. All rights reserved Design Document The next step in the Software.
Ch6: Software Verification. 1 Statement coverage criterion  Informally:  Formally:  Difficult to minimize the number of test cases and still ensure.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
1 Software Testing and Quality Assurance Lecture 30 – Testing Systems.
1 Software Testing and Quality Assurance Lecture 25 – Testing Interactions (Chapter 6)
7. 2Object-Oriented Analysis and Design with the Unified Process Objectives  Detailed Object-Oriented Requirements Definitions  System Processes—A Use.
Analysis Modeling Dynamic Modeling. Requirements analysis Results in static and dynamic models – Scenario models: use cases (static), swimlane diagrams.
Business Math, Eighth Edition Cleaves/Hobbs © 2009 Pearson Education, Inc. Upper Saddle River, NJ All Rights Reserved Bank Records Checking account.
Database Constraints. Database constraints are restrictions on the contents of the database or on database operations Database constraints provide a way.
CMPT 275 Software Engineering
© 2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
January 27, 2002 ECEN5033 University of Colorado -- Class Testing 1 Specifying interactions Remainder of slides assume Operations defined by a class are.
Python quick start guide
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 19Slide 1 Verification and Validation l Assuring that a software system meets a user's.
TTMG 5103 Module Techniques and Tools for problem diagnosis and improvement prior to commercialization Shiva Biradar TIM Program, Carleton University.
Dynamic Black-Box Testing Part 2
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
1 Business Math Chapter 4: Banking. Cleaves/Hobbs: Business Math, 7e Copyright 2005 by Pearson Education, Inc. Upper Saddle River, NJ All Rights.
מידול התנהגותי 1. Today’s Session Sequence Diagrams State Machines 2.
 CS 5380 Software Engineering Chapter 8 Testing.
Software Transition Testing Presented By: Varun Phanda
Agenda Introduction Overview of White-box testing Basis path testing
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
1 © 2005 course technology University Of Palestine Chapter 6 (cont.) Storyboarding the User’s Experience.
Black Box Testing Techniques Chapter 7. Black Box Testing Techniques Prepared by: Kris C. Calpotura, CoE, MSME, MIT  Introduction Introduction  Equivalence.
Originated by K.Ingram, J.Westlake.Edited by N.A.Shulver Use Case Scripts What is a Use Case Script? The text to describe a particular Use Case interaction.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Interaction and Communication Diagrams Patrick Bailey Keith Vander Linden Calvin College.
Sanjay Johal. Introduction(1.1) In this PowerPoint I will be explaining :  The purpose of the code for each of the two given programs, e.g. to carry.
1 Graph Coverage (6). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section
Scenario A scenario is a sequence of steps describing an interaction between a user and a system. Use case is a set of scenarios tied together by a common.
Information Systems Engineering Activity Diagram 1.
0 Glencoe Accounting Unit 3 Chapter 12 Copyright © by The McGraw-Hill Companies, Inc. All rights reserved. Unit 3 Accounting for a Payroll System Chapter.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
State Machine Diagram Chapter 5 Introduction Pages
1 Software Testing and Quality Assurance Lecture 17 - Test Analysis & Design Models (Chapter 4, A Practical Guide to Testing Object-Oriented Software)
Synchronous Counter Design
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
This chapter is extracted from Sommerville’s slides. Textbook chapter 22 1 Chapter 8 Validation and Verification 1.
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 5 Looping.
Black Box Unit Testing What is black-box testing? Unit (code, module) seen as a black box No access to the internal or logical structure Determine.
Checking account - an account held at a bank, credit union or other financial institution in which account owners deposit funds. Account owners have the.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
Testing dan Implementasi Sistem materi 4
Chapter 8 – Software Testing
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Lab 6: Business Process Modeling Notation (BPMN) Additional Exercises
Lab 7: Business Process Modeling Notation (BPMN)
Analysis Modeling Dynamic Modeling.
Princess Nourah bint Abdulrahman University
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Testing techniques and methods
Information Systems Engineering
Presentation transcript:

1 Software Testing and Quality Assurance Lecture 27 – Testing State Transition Diagrams

2 State-Transition Testing Example State-Transition diagrams are an excellent tool to capture certain types of system requirements and to document internal system design. These diagrams document the events that come into and are processed by a system as well as the system's responses.

3 Reservation System Example giveInfo, is an event that comes into the system from the outside world. The command after the "/" denotes an action of the system; in this case startPayTimer.

4 Reservation System Example When money is paid, through initiation of the PayMoney action, the system goes into the “Paid” state. Events may have parameters associated with them. For example, Pay Money may indicate Cash, Check, Debit Card, or Credit Card When the ticket is printed, the system goes into the Ticketed State Upon boarding the plane, the customer gives the boarding pass along with the ticket, which signals that the ticket has been Used.

5 Reservation System Example If the Reservation is not paid on time, the PayTimer expires and the Reservation is cancelled for non-payment. A reservation may become cancelled if the customer wishes to do so. This can happen prior to payment or after payment. If after payment, a refund needs to be generated.

6 Reservation System Example If the customer had the tickets with him, a refund cannot be given unless the printed ticket itself is returned to the agent. This introduces one new notational element—square brackets [] that contain a conditional that can be evaluated either True or False. This conditional acts as a guard allowing the transition only if the condition is true.

7 State Transition Diagram of the Reservation System

8 8- Customer cancels after receiving the ticket (cont.) Cancellation from the Ticketed state

9 State-Transition Tables State-transition tables may be easier to use in a complete and systematic manner. State-transition tables consist of four columns— Current State, Event, Action, and Next State.

10 State-Transition Tables Build the state-transition table as follows For each state of the system For each event/trigger of the system Find the corresponding (Action, Next State) [if any] Document (state, event, action, next state)

11

12

13

14

15 State-Transition Tables (Cont.) The advantage of a state-transition table is that it lists all possible state-transition combinations, not just the valid ones. When testing critical, high-risk systems such as avionics or medical devices, testing every state-transition pair may be required, including those that are not valid.

16 State-Transition Tables (Cont.) Creating a state-transition table often unearths combinations that were not identified, documented, or dealt with in the requirements. It is highly beneficial to discover these defects before coding begins.

17 State-Transition Tables (Cont.) Using a state-transition table can help detect defects in implementation that enable invalid paths from one state to another. The disadvantage of such tables is that they become very large very quickly as the number of states and events increases. In addition, the tables are generally sparse; that is, most of the cells are empty.

18 Creating Test Cases 1. Create a set of test cases such that all states are "visited" at least once under test. The set of three test cases shown below meets this requirement. Generally this is a weak level of test coverage.

19 A set of test cases that "visit" each state

20 Creating Test Cases (Cont.) 2. Create a set of test cases such that all events are triggered at least once under test. Note that the test cases that cover each event can be the same as those that cover each state. Again, this is a weak level of coverage.

21 A set of test cases that trigger all events at least once

22 Creating Test Cases (Cont.) 3. Create a set of test cases such that all paths are executed at least once under test. While this level is the most preferred because of its level of coverage, it may not be feasible. If the state-transition diagram has loops, then the number of possible paths may be infinite. For example, given a system with two states, A and B, where A transitions to B and B transitions to A. A few of the possible paths are: A→B A→B→A A→B→A→B→A→B A→B→A→B→A→B→A... and so on forever.

23 3. Create a set of test cases such that all paths are executed at least once under test (Cont.) Testing of loops such as this can be important if they may result in accumulating computational errors or resource loss (locks without corresponding releases, memory leaks, etc.).

24 Creating Test Cases (Cont.) 4. Create a set of test cases such that all transitions are exercised at least once under test. This level of testing provides a good level of coverage without generating large numbers of tests. This level is generally the one recommended.

25 A set of test cases that trigger all transitions at least once

26 4. A set of test cases that trigger all transitions at least once (Cont.) Test cases can also be read directly from the state- transition table. The gray rows in the following table show all the valid transitions.

27

28

29

30 State-Transition Testing (Cont.) In addition, depending on the system risk, you may want to create test cases for some or all of the invalid state/event pairs to make sure the system has not implemented invalid paths. Applicability and Limitations State-Transition diagrams are excellent tools to capture certain system requirements, namely those that describe states and their associated transitions. These diagrams then can be used to direct our testing efforts by identifying the states, events, and transitions that should be tested.

31 State-Transition Testing (Cont.) State-Transition diagrams are not applicable when the system has no state or does not need to respond to real-time events from outside of the system. An example is a payroll program that reads an employee's time record, computes pay, subtracts deductions, saves the record, prints a paycheck, and repeats the process.

32 Key Points State-Transition diagrams direct our testing efforts by identifying the states, events, actions, and transitions that should be tested. Together, these define how a system interacts with the outside world, the events it processes, and the valid and invalid order of these events. A state-transition diagram is not the only way to document system behaviour. They may be easier to comprehend, but state-transition tables may be easier to use in a complete and systematic manner.

33 Key Points The generally recommended level of testing using state-transition diagrams is to create a set of test cases such that all transitions are exercised at least once under test. In high-risk systems, you may want to create even more test cases, approaching all paths if possible.