State Transition Testing

Slides:



Advertisements
Similar presentations
Numbers Treasure Hunt Following each question, click on the answer. If correct, the next page will load with a graphic first – these can be used to check.
Advertisements

1 A B C
Simplifications of Context-Free Grammars
Variations of the Turing Machine
3rd Annual Plex/2E Worldwide Users Conference 13A Batch Processing in 2E Jeffrey A. Welsh, STAR BASE Consulting, Inc. September 20, 2007.
Zhongxing Telecom Pakistan (Pvt.) Ltd
AP STUDY SESSION 2.
1
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 4 Computing Platforms.
Processes and Operating Systems
David Burdett May 11, 2004 Package Binding for WS CDL.
Prepared by: Workforce Enterprise Services For: The Illinois Department of Commerce and Economic Opportunity Bureau of Workforce Development ENTRY OF EMPLOYER.
Local Customization Chapter 2. Local Customization 2-2 Objectives Customization Considerations Types of Data Elements Location for Locally Defined Data.
Process a Customer Chapter 2. Process a Customer 2-2 Objectives Understand what defines a Customer Learn how to check for an existing Customer Learn how.
Custom Services and Training Provider Details Chapter 4.
CALENDAR.
Date: File: PRO1_17E.1 SIMATIC S7 Siemens AG All rights reserved. Information and Training Center Knowledge for Automation Solutions (Version.
1 Advanced Tools for Account Searches and Portfolios Dawn Gamache Cindy Bylander.
The 5S numbers game..
Photo Slideshow Instructions (delete before presenting or this page will show when slideshow loops) 1.Set PowerPoint to work in Outline. View/Normal click.
© Tally Solutions Pvt. Ltd. All Rights Reserved Shoper 9 License Management December 09.
Testing the Workflows of a System
Biostatistics Unit 5 Samples Needs to be completed. 12/24/13.
Break Time Remaining 10:00.
Factoring Quadratics — ax² + bx + c Topic
EE, NCKU Tien-Hao Chang (Darby Chang)
Equivalence Partitioning
Turing Machines.
Anything But Typical Learning to Love JavaScript Prototypes Page 1 © 2010 Razorfish. All rights reserved. Dan Nichols March 14, 2010.
Table 12.1: Cash Flows to a Cash and Carry Trading Strategy.
Software testing.
Testing Constrained Combinations Vera Pironska QA Engineer XAML Team 1 XAML Team 1 Telerik QA Academy Telerik QA Academy.
© Telcordia Technologies 2004 – All Rights Reserved AETG Web Service Advanced Features AETG is a service mark of Telcordia Technologies. Telcordia Technologies.
PP Test Review Sections 6-1 to 6-6
John Ogilvie High School - CfE Physics
Outline Minimum Spanning Tree Maximal Flow Algorithm LP formulation 1.
Software Testing and Quality Assurance
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 24.1 Test-Driving the Ticket Information Application.
Developing the Project Plan
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Office 2003 Integration Integrating Office 2003 Applications and the World Wide Web.
Operating Systems Operating Systems - Winter 2010 Chapter 3 – Input/Output Vrije Universiteit Amsterdam.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
 Copyright I/O International, 2013 Visit us at: A Feature Within from Item Class User Friendly Maintenance  Copyright.
Lilian Blot PART III: ITERATIONS Core Elements Autumn 2012 TPOP 1.
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
Adding Up In Chunks.
Chapter 10 Software Testing
HORIZONT 1 XINFO ® The IT Information System HORIZONT Software for Datacenters Garmischer Str. 8 D München Tel ++49(0)89 /
GEtServices Services Training For Suppliers Requests/Proposals.
: 3 00.
5 minutes.
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Types of selection structures
1 Titre de la diapositive SDMO Industries – Training Département MICS KERYS 09- MICS KERYS – WEBSITE.
Essential Cell Biology
Clock will move after 1 minute
PSSA Preparation.
Physics for Scientists & Engineers, 3rd Edition
Energy Generation in Mitochondria and Chlorplasts
Select a time to count down from the clock above
Copyright Tim Morris/St Stephen's School
1.step PMIT start + initial project data input Concept Concept.
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
The Pumping Lemma for CFL’s
FIGURE 3-1 Basic parts of a computer. Dale R. Patrick Electricity and Electronics: A Survey, 5e Copyright ©2002 by Pearson Education, Inc. Upper Saddle.
Benchmark Series Microsoft Excel 2013 Level 2
Presentation transcript:

State Transition Testing Testing Depending on the Transition History Petar Horozov Nikolay Nedyalkov Senior QA Engineer Senior QA Engineer XAML Team 4 XAML Team 4 Telerik QA Academy

Table of Contents What is state transition testing Deriving Test Cases Superstates and Substates State Transition Tables Generating Test Cases From State Transition Tables Switch Coverage State Testing with Other Techniques

What is State Transition Testing? Main Concepts of State Transition Testing

What is State Transition Testing? A black-box test design technique in which test cases are designed to execute valid and invalid state transitions

When Is State-based Testing Useful? When can we use State-based testing? When we have sequences of events that occur and conditions that apply to those events When the proper handling of a particular event/condition situation depends on the events and conditions that have occurred in the past

The Bug Hypothesis What is the bug hypothesis in state-based testing? We're looking for situations where the wrong action or the wrong new state occurs in response to a particular event Under a given set of conditions based on the history of event/condition combinations so far

State Transition Diagrams Demo

Transition Diagrams and Tables The underlying model for State-based testing is a state transition diagram or table The diagram or table connects beginning states, events, and conditions with resulting states and actions

States / Events / Actions How do we distinguish a state, an event, and an action? State Persists until something external happens, usually triggering a transition A state can persist for an indefinite period

States / Events / Actions (2) How do we distinguish a state, an event, and an action? Event Occurs, either instantly or in a limited, finite period It is the something that happens The external occurrence that triggers the transition

States / Events / Actions (3) How do we distinguish a state, an event, and an action? Action The response of the system during the transition An action, like an event, is either instantaneous or requires a limited, finite period

Coverage Criterions Various coverage criteria apply for state-based testing: Visiting every state and traverse every transition The weakest criterion

Coverage Criterions Various coverage criteria apply for state-based testing: At least one test cover every row in a state transition table High coverage criterion Achieves "every state and transition" coverage Covers also combinations not presented in diagrams

Coverage Criterions (2) Various coverage criteria apply for state-based testing: At least one test cover each transition sequence of N or less length The N can be 1, 2, 3, 4, or higher Also called "N-1 switch coverage" Coverage depends on the size of N: E.g.: If we cover all transitions of length one and two, then N-1 switch coverage means 1-switch coverage

Customer vs. System Point of View State transition diagrams can be represented differently according to the point of view: Customer's point of view System's point of view Maintaining a consistent point of view is critical Otherwise, nonsensical results may occur

Procedure for Deriving State-based Tests Deriving Test Cases Procedure for Deriving State-based Tests

Procedure for Deriving Tests State-based testing provides a formal procedure for deriving tests Setting a rule for where a test procedure or test step must start and where it may or must end E.g., a test step may start in an initial state and may only end in a final state The initial and final states can be the same Sequences of states and transitions that pass through the initial state more than once can be allowed

Procedure for Deriving Tests State-based testing provides a formal procedure for deriving tests Defining a sequence of event/condition combinations that leads to an allowed test ending state Performed from an allowed test starting state For each transition that will occur, the expected action that the system should take is captured Represents the expected result

Procedure for Deriving Tests State-based testing provides a formal procedure for deriving tests Each visited state and traversed transition should be marked as covered The easiest way to do this is by printing the state transition diagram and then using a marker to highlight each node and arrow as you cover it

Procedure for Deriving Tests State-based testing provides a formal procedure for deriving tests Steps 2 and 3 should be repeated until all states have been visited and all transitions traversed I.e. every node and arrow has been marked with the marker

Logical vs. Concrete Tests The procedure presented before will generate logical test cases For concrete test cases to be created, actual input values and the actual output values have to be generated

Coverage Completeness Check When deriving case-based tests a check of coverage completeness achieved have to be done According to the form used for checking the steps made Generating tests is not completed until every state and every transition has been highlighted in the check-form

Superstates and Substates

Superstates and Substates A single state can be unfolded into a superstate consisting of two or more substates substate Purchasing entering address Specify- ing payment Editing order Purchasing superstate

Superstate Coverage Rule The rule for basic coverage requires covering: All transitions into the superstate All transitions out of the superstate All substates All transitions within the superstate

State Transition Tables

Constructing State Transition Tables Constructing state transition tables follows the scheme: List all the states from the state transition diagram List all the event/condition combinations shown on the state transition diagram Create a table that has a row for each state with every event/condition combination

State Transition Tables - Rows Each row in a state transition table has four fields: Current state Event/condition Action New state

Why State Transition Tables? They force us to consider combinations of states with event/condition combinations that we might have forgotten

Discovering Undefined Situations Deriving state transition tables can reveal undefined situations Forgotten by the business analysts Considered to be impossible The test analyst has the task to find the way a barely possible situation may occur

State Transition Tables Demo

Generating Test Cases From State Transition Tables

Deriving Table-based Tests Deriving tests covering a state transition table can be based on the following steps: Start with a set of tests derived from a state transition diagram Including the starting and stopping state rule Achieves state/transition covered

Deriving Table-based Tests (2) Deriving tests covering a state transition table can be based on the following steps: Construct the state transition table and confirm that the tests cover all the defined rows If they do not, then there is a problem with the existing set of tests, the table generated or the state transition diagram Do not proceed until you have identified and resolved the problem

Deriving Table-based Tests (3) Deriving tests covering a state transition table can be based on the following steps: Select a test that visits a state for which one or more undefined rows exists in the table Modify that test to attempt to introduce the undefined event/condition combination for that state Notice that the action in this case is undefined

Deriving Table-based Tests (4) Deriving tests covering a state transition table can be based on the following steps: Mark covered rows You can use a printed version of the table and a marker for highlighting Repeat steps 3 and 4 until all rows have been covered

One Undefined Combination per Step Each test step should include a single undefined event/condition combination Two undefined actions should not be combined in a single test step We can't be sure that the system will remain testable after the first invalid

Handling Undefined Conditions What is the ideal system behavior under undefined conditions? Undefined event/condition combination should be ignored or rejected with an intelligent error message Processing continues normally from that point

Generating Transitions Using the Concept of Switch Coverage

What is Switch Coverage? Switch Coverage is a technique for generating sequences of transitions State labels are replaced in the diagram with letters and the transition labels with numbers A state/transition pair can be specified in a table as a letter followed by a number

Switch Coverage Demo

Switch Coverage Example B C D E F 1 9 2 10 11 5 3 6 14 13 12 7 8 4 0-switch 1-switch A1 A2 A9 A1A1 A1A2 A1A9

Switch Coverage Example(2) B C D E F 1 9 2 10 11 5 3 6 14 13 12 7 8 4 0-switch 1-switch A1 A2 A9 A1A1 A1A2 A1A9 A9 B10 A9B8 A9B3 B10 B8 B3 B10 C14 B10 C11 B10 C4 B8A1 B8A2 B8A9 C14 C11 C4 C14 C14 C14 C11 C14 C4 C11 D13 C11 D12 C11 D5 D13 D12 D5 D13 D13 D13 D12 D13 D5 D12 F6 D12 F7 F6 F7 F7A1 F7A2 F7A9

Combining State Testing with Other Techniques

State Testing with Other Techniques State-based testing can be well combined with equivalence partitioning and boundary value analysis EP pay [good] American Express MasterCard Visa Invalid (zero) Invalid (too large) purchase [bad] BVA Invalid (neg.) Invalid (too low) Valid -max purchase [good] -0.01 0.01 9.99 10 10,000 10,000.01 max

State Transition Testing ? ? ? ? ? Questions? ? ? ? ? ? ?

* Exercises (1) Given the following state transition diagram – which of the test cases below will cover the following series of state transitions? S1 S0 S1 S2 S0 C, A, B, D A, B, C, D D, A, B A, B, C S0 S1 S2 A B C D (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

* Exercises (2) Given the following state transition diagram which of the following series of state transitions contains an INVALID transition which may indicate a fault in the system design? Login Browse Basket Check-out Pay Log-out A B D F G C E Login Browse Basket Checkout Basket Checkout Pay Logout Login Browse Basket Checkout Pay Logout Login Browse Basket Checkout Basket Logout Login Browse Basket Browse Basket Checkout Pay Logout (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

* Exercises (4) Consider the following state transition diagram of a switch. Which of the following represents an invalid state transition? OFF to ON ON to OFF FAULT to ON (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

Exercises (5) For the examples on the next slides perform the following: Draw a state transition diagram Determine the level of coverage Make a state transition table from the diagram Define logical test cases

Exercises (6) Two-speed electric toothbrush * Exercises (6) Two-speed electric toothbrush A two-speed electric toothbrush is operated by pressing its one button The first press of the button turns the toothbrush from off to speed one, the second press of the button turns it to speed two When the button is pressed for a third time the electric toothbrush is turned off (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

Exercises (7) Tape player * Exercises (7) Tape player A tape player has three operations: play, fast forward and fast play. Play and fast forward are activated using the play and fast forward button respectively. These operations can be cancelled using the stop button. When in play mode, the fast forward can be used to fast play. When in fast play mode, the fast forward button can be pressed again to enter fast forward or the stop button can be used to return to play. When in fast forward the play button can be pressed to enter play mode directly. (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

Exercises (8) Simple electronic clock * Exercises (8) Simple electronic clock A simple electronic clock has four modes: display time, change time, display date and change date The change mode button switches between display time and display date The reset button switches from display time to adjust time or display date to adjust date The set button returns from adjust time to display time or adjust date to display date (c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

Resources http://istqbexamcertification.com/what-is- state-transition-testing-in-software-testing/ http://www.ruleworks.co.uk/testguide/BS7925 -2-Annex-B3.asp

Contacts Nikolay Nedyalkov Petar Horozov email: nikolay.nedyalkov@telerik.com Petar Horozov email: petar.horozov@telerik.com