Automated Model Based Testing From Theory via Tools to

Download Report

Transcript Automated Model Based Testing From Theory via Tools to

Formal Testing with Labelled
Transition Systems
Ed Brinksma
Course 2004
Goal : Formal Testing
with Transition Systems
Test hypothesis :
s  LTS
ioco
der : LTS 
(TTS)
IUTIMPS . iIUT IOTS .
tTTS . exec(t,IUT) = obs(t,iIUT)
Ts  TTS
Proof soundness and exhaustivess:
iIOTS .
( tder(s) . t(obs(t,i)) = pass )
 i ioco s
pass
iIUT
IUT IOTS
IMPS
obs
: TTS
exec
:
TESTS
IOTS 
IMPS


(traces)
(OBS)
© Ed Brinksma/Jan Tretmans
TT 2004, LTS
traces
2
t:
(traces)
{fail,pass}
fail
Labelled Transition Systems
a
a
b
a
b
a
b
b
a
a
© Ed Brinksma/Jan Tretmans
b

a
a
c
c
TT 2004, LTS
3
a
b
a
b
a
b
a
b
Labelled Transition Systems
s
S0
dub
S0
dub
transition
S1
kwart
S1
S2
coffee
S3
S0

S4
tea
S0
S0
dub coffee
kwart tea
kwart soup
S5
L = { dub,kwart,
coffee,tea,soup}
© Ed Brinksma/Jan Tretmans
executable
sequence
non-executable
sequence
all transition
systems over L
LTS(L)
TT 2004, LTS
S3
transition
composition
4
Labelled Transition Systems
Sequences of observable actions:
s
S0
dub
traces (s) = {   L* | s
dub
S1
S2
coffee
S3
tea
S4
}
traces(s) = { , dub, dub coffee, dub tea }
Reachable states:

s after  = { s’ | s
s after dub = {
S1, S2
s after dub tea = {
© Ed Brinksma/Jan Tretmans

TT 2004, LTS
5
}
S4
}
s’ }
Labelled Transition Systems
Labelled Transition System
 S, L, T, s0 
initial state
states
actions
transitions
T  S  (L{})  S
Discon
ConReq
Discon
Data
ConConf
© Ed Brinksma/Jan Tretmans
TT 2004, LTS
6
s0  S
Representation of LTS
S
 Explicit :
 {S0,S1,S2,S3},
S0
{dub,coffee,tea},
dub
{ (S0,dub,S1), (S1,coffee,S2), (S1,tea,S3) },
S1
coffee
S2
S0 
tea
S3
 Transition tree / graph
 Language / behaviour expression :
S := dub ; ( coffee ; stop [] tea ; stop )
© Ed Brinksma/Jan Tretmans
TT 2004, LTS
7
Labelled Transition Systems
a
a
b
a
stop
b
a
b
P
where P := a ; P
a ; stop [] b ; stop
a
b
a ; b ; stop
b
a
© Ed Brinksma/Jan Tretmans
b
a

a
a
c
c
TT 2004, LTS
8
a
b
a
b
a
b
Labelled Transition Systems
Q
where Q := a ; ( b ; stop ||| Q )
a ; b ; stop [] a ; c ; stop
a ; stop []  ; c ; stop
a ; stop ||| b ; stop
a
b
b
a
a
© Ed Brinksma/Jan Tretmans
b

a
a
c
c
TT 2004, LTS
9
a
b
a
b
a
b
a
b
Language of Behaviour Expressions
 Process Algebra :
algebra of processes with behaviour operators
 Operational semantics in labelled transition systems
 Concise, structured, compositional representation
of labelled transition systems
 Behaviour operators :
 inaction
stop
 action prefix
a ; B
B1 || B2
 ;
B2 ||| B2
 Parallelism
B
 choice
B1 [] B2
 hiding
hide G in B
© Ed Brinksma/Jan Tretmans
TT 2004, LTS
 process def.
where
10
B1 |[ G ]| B2
p
p := Bp
Language of Behaviour Expressions
 inaction
stop
 action prefix
a ;B
a
B
 choice
B1 [] B2
B1
© Ed Brinksma/Jan Tretmans
TT 2004, LTS
B2
11
B2
Language of Behaviour Expressions
 hiding
hide a in B
a
hide
B2 a
in B2
hide a
B1
in
B1
 process definition p
where p := Bp
P =
Bp
© Ed Brinksma/Jan Tretmans
TT 2004, LTS
12
Language of Behaviour Expressions
 parallel composition B1 |[a]| B2
a
Bx
a
a
|[a]|
=
By
Bx|[a]|By
b
b
c
|[a]|
BxTretmans
© Ed Brinksma/Jan
c
=
TTBy
2004, LTS
13
Bx|[a]|c;By
b;Bx|[a]|By
Language of Behaviour Expressions
 parallel composition B1 |[a,b]| B2
a
Bx
b
|[a,b]|
 synchronization
 interleaving
© Ed Brinksma/Jan Tretmans
=
By
B1 || B2
B1 ||| B2
==def
==def
B1 |[ L ]| B2
B1 |[  ]| B2
TT 2004, LTS
14
Structural Operational Semantics
 Formal semantics of behaviour expressions
through Structural Operational Semantics (SOS)
 Example: parallel composition p |[ G ]| q
p
a
p’,
p |[ G ]| q
p
a
p |[ G ]| q
p’,
a
© Ed Brinksma/Jan Tretmans
q
a
a
aG
q’,
p’ |[ G ]| q’
aG
q
p’ |[ G ]| q
a
p |[ G ]| q
TT 2004, LTS
15
q’,
a
aG
p |[ G ]| q’
Example : Parallel Composition
U
M
dub
coffee
kwart
coffee
tea
U'
M'
M || U
© Ed Brinksma/Jan Tretmans
dub
dub coffee
TT 2004, LTS
M' || U'
16
tea
Example : Behaviour Expression
 Simple buffer
(|domain(x)|+1 states)
in ? x
x
out ! x
in ? x
out ! x
Buf [in,out]
© Ed Brinksma/Jan Tretmans
:=
in ? x ; out ! x ; Buf [in,out]
TT 2004, LTS
17
Example : Behaviour Expression
 Double buffer
((|domain(x)|+1)2 states)
mid ! x
in ? x
in ? x
(x,)
(,x’)
out ! x’
out ! x’

(,)
out ! x’
mid ? x’
(x,x’)
in ? x
DBuf [in,out] :=
hide mid in
© Ed Brinksma/Jan Tretmans
Buf [in,mid] |[mid]| Buf [mid,out]
TT 2004, LTS
18
Example : Behaviour Expression
Six-Double buffers
((|domain(x)|+1)12 states)
out ! x
out ! x
out ! x
out ! x
out ! x
out ! x
in ? x
in ? x
in ? x
in ? x
in ? x
in ? x
SixDBuf [in,out] :=
DBuf ||| DBuf ||| DBuf ||| DBuf ||| DBuf ||| DBuf
© Ed Brinksma/Jan Tretmans
TT 2004, LTS
19