Introduction to Software Testing Chapter 3.5 Logic Coverage for FSMs

Slides:



Advertisements
Similar presentations
Introduction to Software Testing Chapter 1 Model-Driven Test Design Paul Ammann & Jeff Offutt
Advertisements

Introduction to Software Testing Chapter 3.3 Logic Coverage from Source Code Paul Ammann & Jeff Offutt.
Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 1 Paul Ammann & Jeff Offutt SUMMARY OF PARTS 1 AND 2 FROM LAST WEEK.
Introduction to Software Testing Chapter 2.6 Graph Coverage for Use Cases Paul Ammann & Jeff Offutt
CITS5501 Software Quality and Testing Logic and Path Coverage From Introduction to Software Testing, 2 nd ed, Ammann & Offutt.
Introduction to Software Testing Chapter 2.6 Graph Coverage for Use Cases Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.1 Logic Coverage Paul Ammann & Jeff Offutt.
Introduction to Software Testing Chapter 9.4 Model-Based Grammars Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 2.3 Graph Coverage for Source Code Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 8.1 Logic Coverage Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 2.5 Graph Coverage for Specifications Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 8.1 Building Testing Tools –Instrumentation Paul Ammann & Jeff Offutt
SWE 637: Test Criteria and Definitions Tao Xie Prepared based on Slides by ©Paul Ammann and Jeff Offutt Revised by Tao Xie.
Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapters 1-5 Coverage Summary Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 2.3 Graph Coverage for Source Code Paul Ammann & Jeff Offutt
Introduction to Software Testing Paul Ammann & Jeff Offutt Updated 24-August 2010.
1 Graph Coverage (5). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section
Introduction to Software Testing Chapter 9.2 Program-based Grammars Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.1 Logic Coverage Paul Ammann & Jeff Offutt.
Workshop on Integrating Software Testing into Programming Courses (WISTPC14:2) Friday July 18, 2014 Introduction to Software Testing.
Introduction to Software Testing (2nd edition) Chapter 5 Criteria-Based Test Design Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 8.5 Logic Coverage for FSMs Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 8.1 Logic Coverage
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3, Sec# 1 & 2 Logic Coverage
Finite State Machines Dr K R Bond 2009
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 9.2 Program-based Grammars
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage
Logic Coverage CS 4501 / 6501 Software Testing
Graph Coverage for Design Elements CS 4501 / 6501 Software Testing
Introduction to Software Testing Chapter 5.1 Syntax-based Testing
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 5.2 Program-based Grammars
Introduction to Software Testing Chapter 8.5 Logic Coverage for FSMs
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3, Sec# 3.5
Moonzoo Kim School of Computing KAIST
Introduction to Software Testing Chapter 3.2 Logic Coverage
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.5 Logic Coverage for FSMs
Logic Coverage CS 4501 / 6501 Software Testing
Graph Coverage for Design Elements CS 4501 / 6501 Software Testing
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Paul Ammann & Jeff Offutt
Graph Coverage Criteria CS 4501 / 6501 Software Testing
Logic Coverage for Source Code CS 4501 / 6501 Software Testing
Introduction to Software Testing Chapter 5.1 Syntax-based Testing
Introduction to Software Testing Chapter 8.1 Logic Coverage
Introduction to Software Testing Chapter 8.5 Logic Coverage for FSMs
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 3.2 Logic Coverage
Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage
Presentation transcript:

Introduction to Software Testing Chapter 3.5 Logic Coverage for FSMs Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/softwaretest/

Covering Finite State Machines FSMs are graphs nodes represent state edges represent transitions among states Transitions often have logical expressions as guards or triggers As we said: Find a logical expression and cover it Introduction to Software Testing (Ch 3) © Ammann & Offutt

Example—Subway Train All Doors Open Left Doors Open Right Doors Open secondPlatform = right secondPlatform= left ¬ emergencyStop  ¬ overrideOpen  doorsClear (all three transitions) Left Doors Open Right Doors Open All Doors Closed trainSpeed = 0  platform=left  (inStation  (emergencyStop  overrideOpen)) trainSpeed = 0  platform=right  (inStation  (emergencyStop  overrideOpen)) Introduction to Software Testing (Ch 3) © Ammann & Offutt

Determination of the Predicate trainSpeed = 0  platform=left  (inStation  (emergencyStop  overrideOpen)) trainSpeed = 0 : platform = left  (inStation  (emergencyStop  overrideOpen)) platform = left : trainSpeed = 0  (inStation  (emergencyStop  overrideOpen)) inStation : trainSpeed = 0  platform = left  (¬ emergencyStop  ¬ overrideOpen) emergencyStop : trainSpeed = 0  platform = left  (¬ inStation  overrideOpen) overrideOpen : trainSpeed = 0  platform = left  (¬ inStation  emergencyStop) Introduction to Software Testing (Ch 3) © Ammann & Offutt

Test Truth Assignments (CACC) trainSpeed = 0  platform=left  (inStation  (emergencyStop  overrideOpen)) trainSpeed=0 platform=left inStation emergencyStop overrideOpen trainSpeed = 0 T t trainSpeed != 0 F platform = left platform != left f ¬ inStation ¬ emergencyStop ¬ overrideOpen Note : other choices are possible duplicate duplicate Introduction to Software Testing (Ch 3) © Ammann & Offutt

Complicating Issues Some buttons must be pressed simultaneously to have effect – so timing must be tested Reachability : The tests must reach the state where the transition starts (the prefix) Exit : Some tests must continue executing to an end state Expected output : The expected output is the state that the transition reaches for true values, or same state for false values Accidental transitions : Sometimes a false value for one transition happens to be a true value for another The alternate expected output must be recognized Introduction to Software Testing (Ch 3) © Ammann & Offutt

Test Scripts Test scripts are executable sequences of value assignments Mapping problem : The names used in the FSMs may not match the names in the program Sometimes a direct name-to-name mapping can be found Sometimes more complicated actions must be taken to assign the appropriate values Simulation : Directly inserting value assignments into the middle of the program The solution to this is implementation-specific Introduction to Software Testing (Ch 3) © Ammann & Offutt

Summary FSM Logic Testing FSMs are widely used at all levels of abstraction Many ways to express FSMs Statecharts, tables, Z, decision tables, Petri nets, … Predicates are usually explicitly included on the transitions Guards Actions Often represent safety constraints FSMs are often used in embedded software Introduction to Software Testing (Ch 3) © Ammann & Offutt