SlideShare a Scribd company logo
1 of 30
1
Software Testing and Quality
Assurance
Testing State Transition Diagrams
2
Outline
 Generating State Transition Diagrams
 State-Transition Tables
 Creating Test Cases
3
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.
4
Reservation System Example
1- Make a reservation
 Provide information including departure and destination
cities, dates, and times.
 A reservation agent uses that information to make a
reservation.
 At that point, the Reservation is in the Made state.
The system creates and starts a timer.
 If this timer expires before the reservation is paid for, the
reservation is cancelled by the system.
5
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.
6
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.
 Anything else after this state?
7
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.
 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.
8
State Transition Diagram of the Reservation System
9
8- Customer cancels after receiving the ticket (cont.)
Cancellation from
the Ticketed state
10
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.
 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.
 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.
16
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.
17
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.
18
A set of test cases that "visit" each state
19
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.
20
A set of test cases that trigger all events at least once
21
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.
22
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.).
23
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.
24
A set of test cases that trigger all transitions at least once
25
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.
26
27
28
29
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.
 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.
30
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.
 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.

More Related Content

What's hot

Fractional nonconforming (p – chart)
Fractional nonconforming (p – chart)Fractional nonconforming (p – chart)
Fractional nonconforming (p – chart)Mrinmoy Bharadwaz
 
Analysing control charts
Analysing control chartsAnalysing control charts
Analysing control chartsjohnsqms
 
Control Charts: Xbar-S Chart
Control Charts: Xbar-S ChartControl Charts: Xbar-S Chart
Control Charts: Xbar-S ChartMatt Hansen
 
Control Charts for variables Xbar and R chart and attributes P, nP, C, and u ...
Control Charts for variables Xbar and R chart and attributes P, nP, C, and u ...Control Charts for variables Xbar and R chart and attributes P, nP, C, and u ...
Control Charts for variables Xbar and R chart and attributes P, nP, C, and u ...Dr.Raja R
 
Construction quality management
Construction quality managementConstruction quality management
Construction quality managementselinasimpson0401
 
Statistical Process Control
Statistical Process ControlStatistical Process Control
Statistical Process ControlMarwa Abo-Amra
 
Generation of state diagram from time chart
Generation of state diagram from time chartGeneration of state diagram from time chart
Generation of state diagram from time chartRahulGandhi110
 
Control Charts: I-MR Chart
Control Charts: I-MR ChartControl Charts: I-MR Chart
Control Charts: I-MR ChartMatt Hansen
 
Control charts for attributes
Control charts for attributesControl charts for attributes
Control charts for attributesBuddy Krishna
 
Forecasting warranty returns with Wiebull Fit
Forecasting warranty returns with Wiebull FitForecasting warranty returns with Wiebull Fit
Forecasting warranty returns with Wiebull FitTonda MacLeod
 
Tools Of Quality Management PowerPoint Presentation Slides
Tools Of Quality Management PowerPoint Presentation Slides Tools Of Quality Management PowerPoint Presentation Slides
Tools Of Quality Management PowerPoint Presentation Slides SlideTeam
 
The proper analysis approach for life data
The proper analysis approach for life dataThe proper analysis approach for life data
The proper analysis approach for life dataASQ Reliability Division
 

What's hot (20)

C chart
C chartC chart
C chart
 
Fractional nonconforming (p – chart)
Fractional nonconforming (p – chart)Fractional nonconforming (p – chart)
Fractional nonconforming (p – chart)
 
X‾ and r charts
X‾ and r chartsX‾ and r charts
X‾ and r charts
 
Analysing control charts
Analysing control chartsAnalysing control charts
Analysing control charts
 
Quality property management
Quality property managementQuality property management
Quality property management
 
X Bar R Charts
X Bar R ChartsX Bar R Charts
X Bar R Charts
 
Control Charts: Xbar-S Chart
Control Charts: Xbar-S ChartControl Charts: Xbar-S Chart
Control Charts: Xbar-S Chart
 
Control Charts for variables Xbar and R chart and attributes P, nP, C, and u ...
Control Charts for variables Xbar and R chart and attributes P, nP, C, and u ...Control Charts for variables Xbar and R chart and attributes P, nP, C, and u ...
Control Charts for variables Xbar and R chart and attributes P, nP, C, and u ...
 
Construction quality management
Construction quality managementConstruction quality management
Construction quality management
 
Statistical Process Control
Statistical Process ControlStatistical Process Control
Statistical Process Control
 
Generation of state diagram from time chart
Generation of state diagram from time chartGeneration of state diagram from time chart
Generation of state diagram from time chart
 
Control Charts: I-MR Chart
Control Charts: I-MR ChartControl Charts: I-MR Chart
Control Charts: I-MR Chart
 
X bar and-r_charts
X bar and-r_chartsX bar and-r_charts
X bar and-r_charts
 
Control charts for attributes
Control charts for attributesControl charts for attributes
Control charts for attributes
 
Forecasting warranty returns with Wiebull Fit
Forecasting warranty returns with Wiebull FitForecasting warranty returns with Wiebull Fit
Forecasting warranty returns with Wiebull Fit
 
7 basic tool for QUALITY
7 basic tool for QUALITY7 basic tool for QUALITY
7 basic tool for QUALITY
 
Seven basic tools of quality
Seven basic tools of qualitySeven basic tools of quality
Seven basic tools of quality
 
Tools Of Quality Management PowerPoint Presentation Slides
Tools Of Quality Management PowerPoint Presentation Slides Tools Of Quality Management PowerPoint Presentation Slides
Tools Of Quality Management PowerPoint Presentation Slides
 
Spc
SpcSpc
Spc
 
The proper analysis approach for life data
The proper analysis approach for life dataThe proper analysis approach for life data
The proper analysis approach for life data
 

Similar to 072 swe415stnotes08

A NEW INNOVATION TECHNIQUE OF STATE TRANSITION TESTING USED FOR DBT
A NEW INNOVATION TECHNIQUE OF STATE TRANSITION TESTING USED FOR DBTA NEW INNOVATION TECHNIQUE OF STATE TRANSITION TESTING USED FOR DBT
A NEW INNOVATION TECHNIQUE OF STATE TRANSITION TESTING USED FOR DBTieijjournal
 
Quality assurance management
Quality assurance managementQuality assurance management
Quality assurance managementselinasimpson0301
 
Supplier quality management system
Supplier quality management systemSupplier quality management system
Supplier quality management systemselinasimpson1901
 
Quality management information system
Quality management information systemQuality management information system
Quality management information systemselinasimpson341
 
Quality management in manufacturing
Quality management in manufacturingQuality management in manufacturing
Quality management in manufacturingselinasimpson2201
 
Define quality management system
Define quality management systemDefine quality management system
Define quality management systemselinasimpson0901
 
Quality management system documentation
Quality management system documentationQuality management system documentation
Quality management system documentationselinasimpson1501
 
Quality assurance project management
Quality assurance project managementQuality assurance project management
Quality assurance project managementselinasimpson0901
 
Laboratory quality management system
Laboratory quality management systemLaboratory quality management system
Laboratory quality management systemselinasimpson0801
 
Electronic quality management system
Electronic quality management systemElectronic quality management system
Electronic quality management systemselinasimpson2401
 
Sample quality management system
Sample quality management systemSample quality management system
Sample quality management systemselinasimpson2501
 
Quality management system procedures
Quality management system proceduresQuality management system procedures
Quality management system proceduresselinasimpson2101
 
Quality management demystified
Quality management demystifiedQuality management demystified
Quality management demystifiedselinasimpson2101
 
Training quality management system
Training quality management systemTraining quality management system
Training quality management systemselinasimpson2701
 
Call center quality management
Call center quality managementCall center quality management
Call center quality managementselinasimpson2601
 
Qms iso 9001
Qms iso 9001Qms iso 9001
Qms iso 9001arikajom
 
Open source quality management system
Open source quality management systemOpen source quality management system
Open source quality management systemselinasimpson2001
 
How to become iso 9001 certified
How to become iso 9001 certifiedHow to become iso 9001 certified
How to become iso 9001 certifiedporikgefus
 
Certified quality management professional
Certified quality management professionalCertified quality management professional
Certified quality management professionalselinasimpson2901
 

Similar to 072 swe415stnotes08 (20)

A NEW INNOVATION TECHNIQUE OF STATE TRANSITION TESTING USED FOR DBT
A NEW INNOVATION TECHNIQUE OF STATE TRANSITION TESTING USED FOR DBTA NEW INNOVATION TECHNIQUE OF STATE TRANSITION TESTING USED FOR DBT
A NEW INNOVATION TECHNIQUE OF STATE TRANSITION TESTING USED FOR DBT
 
Quality assurance management
Quality assurance managementQuality assurance management
Quality assurance management
 
Supplier quality management system
Supplier quality management systemSupplier quality management system
Supplier quality management system
 
Quality management information system
Quality management information systemQuality management information system
Quality management information system
 
Quality management in manufacturing
Quality management in manufacturingQuality management in manufacturing
Quality management in manufacturing
 
Define quality management system
Define quality management systemDefine quality management system
Define quality management system
 
Quality management system documentation
Quality management system documentationQuality management system documentation
Quality management system documentation
 
Quality assurance project management
Quality assurance project managementQuality assurance project management
Quality assurance project management
 
Laboratory quality management system
Laboratory quality management systemLaboratory quality management system
Laboratory quality management system
 
Electronic quality management system
Electronic quality management systemElectronic quality management system
Electronic quality management system
 
Sample quality management system
Sample quality management systemSample quality management system
Sample quality management system
 
Quality management system procedures
Quality management system proceduresQuality management system procedures
Quality management system procedures
 
Quality management demystified
Quality management demystifiedQuality management demystified
Quality management demystified
 
Training quality management system
Training quality management systemTraining quality management system
Training quality management system
 
Call center quality management
Call center quality managementCall center quality management
Call center quality management
 
Qms iso 9001
Qms iso 9001Qms iso 9001
Qms iso 9001
 
Open source quality management system
Open source quality management systemOpen source quality management system
Open source quality management system
 
Quality management quotes
Quality management quotesQuality management quotes
Quality management quotes
 
How to become iso 9001 certified
How to become iso 9001 certifiedHow to become iso 9001 certified
How to become iso 9001 certified
 
Certified quality management professional
Certified quality management professionalCertified quality management professional
Certified quality management professional
 

More from Hendriana Ana

More from Hendriana Ana (9)

3074
30743074
3074
 
Modul statistik 114
Modul statistik 114Modul statistik 114
Modul statistik 114
 
Diktat borlanddelphi 7
Diktat borlanddelphi 7Diktat borlanddelphi 7
Diktat borlanddelphi 7
 
Poster ysc 2014
Poster ysc 2014Poster ysc 2014
Poster ysc 2014
 
Sim kul1
Sim kul1Sim kul1
Sim kul1
 
B2. pedoman-program-coop-umkm-2013
B2. pedoman-program-coop-umkm-2013B2. pedoman-program-coop-umkm-2013
B2. pedoman-program-coop-umkm-2013
 
Caver lpb
Caver lpbCaver lpb
Caver lpb
 
Silabus fisika-sma-kelas-xii1
Silabus fisika-sma-kelas-xii1Silabus fisika-sma-kelas-xii1
Silabus fisika-sma-kelas-xii1
 
Modul myob-v18
Modul myob-v18Modul myob-v18
Modul myob-v18
 

Recently uploaded

Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 

Recently uploaded (20)

Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 

072 swe415stnotes08

  • 1. 1 Software Testing and Quality Assurance Testing State Transition Diagrams
  • 2. 2 Outline  Generating State Transition Diagrams  State-Transition Tables  Creating Test Cases
  • 3. 3 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.
  • 4. 4 Reservation System Example 1- Make a reservation  Provide information including departure and destination cities, dates, and times.  A reservation agent uses that information to make a reservation.  At that point, the Reservation is in the Made state. The system creates and starts a timer.  If this timer expires before the reservation is paid for, the reservation is cancelled by the system.
  • 5. 5 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.
  • 6. 6 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.  Anything else after this state?
  • 7. 7 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.  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.
  • 8. 8 State Transition Diagram of the Reservation System
  • 9. 9 8- Customer cancels after receiving the ticket (cont.) Cancellation from the Ticketed state
  • 10. 10 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.  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. 11
  • 12. 12
  • 13. 13
  • 14. 14
  • 15. 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.  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.
  • 16. 16 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.
  • 17. 17 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.
  • 18. 18 A set of test cases that "visit" each state
  • 19. 19 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.
  • 20. 20 A set of test cases that trigger all events at least once
  • 21. 21 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.
  • 22. 22 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.).
  • 23. 23 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.
  • 24. 24 A set of test cases that trigger all transitions at least once
  • 25. 25 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.
  • 26. 26
  • 27. 27
  • 28. 28
  • 29. 29 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.  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.
  • 30. 30 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.  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.