Model Based Testing Course Software Testing & Verification 2013/14 Wishnu Prasetya.

Slides:



Advertisements
Similar presentations
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Advertisements

Why empty strings? A bit like zero –you may think you can do without –but it makes definitions & calculations easier Definitions: –An alphabeth is a finite.
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Automata Theory Part 1: Introduction & NFA November 2002.
MOdel-based GENeration of Tests for Embedded Systems # FP7-ICT Embedded Systems Design WP3: Qualitative Fault Modelling András Pataricza,
UML State chart/machine diagram State machine diagram is a behavior diagram which shows discrete behavior of a part of designed system through finite state.
Issues in Testing OO Programs (7.1, 2.2.2, 2.4.2) Course Software Testing & Verification 2013/14 Wishnu Prasetya.
4b Lexical analysis Finite Automata
1 Fault Diagnosis for Timed Automata Stavros Tripakis VERIMAG.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
Regular Expressions and DFAs COP 3402 (Summer 2014)
DFA Minimization Jeremy Mange CS 6800 Summer 2009.
Hybrid Systems Presented by: Arnab De Anand S. An Intuitive Introduction to Hybrid Systems Discrete program with an analog environment. What does it mean?
Generating Complex Input (and its other applications) Course Software Testing & Verification 2013/14 Wishnu Prasetya.
Supervisory Control of Hybrid Systems Written by X. D. Koutsoukos et al. Presented by Wu, Jian 04/16/2002.
CS 355 – Programming Languages
Chapter Section Section Summary Set of Strings Finite-State Automata Language Recognition by Finite-State Machines Designing Finite-State.
Generalized Sequential Pattern (GSP) Step 1: – Make the first pass over the sequence database D to yield all the 1-element frequent sequences Step 2: Repeat.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 The scanning process Goal: automate the process Idea: –Start with an RE –Build a DFA How? –We can build a non-deterministic finite automaton (Thompson's.
Technische Universität München Institut für Informatik D München, Germany Realizability of System Interface Specifications Manfred Broy.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
Regular Expressions and Automata Chapter 2. Regular Expressions Standard notation for characterizing text sequences Used in all kinds of text processing.
EECS 20 Chapter 3 Sections State Machines Continued Last time we Introduced the deterministic finite state machine Discussed the concept of state.
Reverse Engineering State Machines by Interactive Grammar Inference Neil Walkinshaw, Kirill Bogdanov, Mike Holcombe, Sarah Salahuddin.
Finite-State Machines with No Output Longin Jan Latecki Temple University Based on Slides by Elsa L Gunter, NJIT, and by Costas Busch Costas Busch.
Finite-State Machines with No Output
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Pushdown Automata (PDAs)
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
Agile Test-based Modeling 資工 聶順成. Outline  Introduction : Modeling meets Programming  Agile Modeling: Using Models in Agile Projects  Model-based.
Lexical Analysis: Finite Automata CS 471 September 5, 2007.
Copyright © Curt Hill Finite State Automata Again This Time No Output.
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Overview of Previous Lesson(s) Over View  Symbol tables are data structures that are used by compilers to hold information about source-program constructs.
CS1Q Computer Systems Lecture 11 Simon Gay. Lecture 11CS1Q Computer Systems - Simon Gay 2 The D FlipFlop The RS flipflop stores one bit of information.
CSCI 115 Chapter 8 Topics in Graph Theory. CSCI 115 §8.1 Graphs.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Finite State Machines (FSM) OR Finite State Automation (FSA) - are models of the behaviors of a system or a complex object, with a limited number of defined.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
Modeling Computation: Finite State Machines without Output
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 10 Automata, Grammars and Languages.
Overview of Previous Lesson(s) Over View  A token is a pair consisting of a token name and an optional attribute value.  A pattern is a description.
1 Language Recognition (11.4) Longin Jan Latecki Temple University Based on slides by Costas Busch from the courseCostas Busch
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics.
CS 154 Formal Languages and Computability February 11 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
Akram Salah ISSR Basic Concepts Languages Grammar Automata (Automaton)
Abstraction and Abstract Interpretation. Abstraction (a simplified view) Abstraction is an effective tool in verification Given a transition system, we.
Wishnu Prasetya Software Testing URL:
Lexical analysis Finite Automata
State Machine Diagrams
Recognizer for a Language
Chapter 2 FINITE AUTOMATA.
Language Recognition (12.4)
Non-Determinism 12CS45 Finite Automata.
Some slides by Elsa L Gunter, NJIT, and by Costas Busch
High-Level Abstraction of Concurrent Finite Automata
Non-Deterministic Finite Automata
DFA-> Minimum DFA Module 05.4 COP4020 – Programming Language Concepts Dr. Manuel E. Bermudez.
Principles of Computing – UFCFA3-30-1
Finite Automata.
4b Lexical analysis Finite Automata
CSCI 2670 Introduction to Theory of Computing
4b Lexical analysis Finite Automata
Language Recognition (12.4)
Presentation transcript:

Model Based Testing Course Software Testing & Verification 2013/14 Wishnu Prasetya

Finite State Machine/Automaton Many variants, depending on the purpose. Let’s take this one: a structure M = (S, s 0, F, E,I,R,P) – S is the set of states of the automaton – s 0  S is its initial state, assuming we only have one. – F  S is the set of its final states, if any. – E is a set of labels on the transitions, representing events/actions. – R is a subset of S  E  S, describing the transitions – I is a set of labels on the states, representing predicates that should hold there – P is a mapping S  Set I, describing which predicates label which states (thus hold on the state). Deterministic; non-deterministic if from some state s, there is an event a that can take M to multiple states. 2

FSA, Modelling a Simple Web Shop 3 selection view +cart selection view item view item view + cart slider(low,hi),... phone(k) selectBtn buy(k) remove(k) buy(k) phone(k) selectBtn slider(low,hi), buy(k), remove slider(low,hi),..., buy(k), remove(k) representing a set of transitions

Advantage & infrastructure A test case is a path through the automaton, e.g. of the form:  1 ;  2 ; assert(q),  1 is a prefix to set-up the state;  2 is the tested sequence; q is an oracle. Automated generation of test sequences  beyond our scope Manual: – guided by use cases (the list of functionalities you have to test) You can make the testing more systematic, by aiming for some concept of model coverage, such as: – edge-pair coverage (note that this is not the same as event-pair coverage) Require logging to infer the state and invoked events 4

Model transformation Making a model more abstract reduces the number of test cases; but of course at the cost of decreased precision. Conversely, making a model more concrete can strengthen your test. Some typical transformation: – Transitions/edges merging – States merging – State splitting 5

Transitions merging Let A be the set of transitions with the same source and destinations. Suppose A’  A actually triggers equivalent behavior; we can merge all transitions in A’ into a new single transition representing the entire A’. 6 S1S2 a,b,c, x,y,z S1S2 , 

State Merging If  is a path through an FSA, its sentence is the sequence of events that label the transitions in the path. Two states s 1 and s 2 are path-equivalent if it possible to merge them into a new state , such that for any path  in the FSA,  [  /s1,  /s2] is a path in the new automaton; and “in a way” also vice versa. Such pair of states can be merged into new state . The predicate that holds in  is /\ P(s 1 ) \/ /\ P(s 2 ) 7 S1 S2  a b c a r t a b rt c cb

State Splitting A state s can be split into multiple states, e.g. s 1 and s 2. Transitions that go to or from s, have to be re-routed to-go- to/to-go-from either s 1 or s 2 ; you have to think which, but the new states should be path-equivalent. The new state each gets a subset of the labels of s; you have to think which predicates are supposed to hold on each. 8 selection-view, N==0 selection-view, 0<N<20 selection-view selection-view, N>20

A concurrent system A system of concurrently running entities can be modeled by multiple FSAs Let M1 and M2 be two FSAs with S1 and S2 as disjoint sets of states. M1 || M2 describes M1 and M2 running concurrently. The states of M1 and M2 are pairs from S1  S2. The transitions are (s,u)  a  (t,u), if s  a  t is a transition in M1; analogously (s,u)  b  (s,v); and (s,u)  c  (t,v) if s  c  t and u  c  v are transitions in M1 and M c a c b M1: M2: 0,01,1 c a b M1|| M2 :

Model of an Simple Game 10 SpaceShip: alivedestroyedgameover move(d) tick alive expired collided tick Bullet: alivecollided tick Asteroids: The FSA Asteroids represent a set of asteroids. The states: alive : at least one asteroid is alive collided: at least one asteroid collides empty : no more asteroid left empty (tick represents frame update)

Using || automaton Usually too big to be constructed manually; automate this. Also too complex to be used to guide manual testing. We fall back to the use-case based testing. Use the || automaton to calculate your coverage, e.g. over its states or transitions. If your coverage is still unacceptably low, use the information to guide you to write new test cases. 11