Qualitätssicherung in der Softwareentwicklung
VU 8
DI Dr. Bernhard K. Aichernig
Institut für Softwaretechnologie (IST) TU Graz
Sommersemester 2012
Outline
1
Conformance Testing Properties
2
Labelled Transition Systems Equivalence
Preorder ioco Examples
3
Test generation
Input/Output Conformance Relation
Jan Tretmans - 1996
Based on IO-Labeled Transition Systems
Input/Output Conformance Relation
Jan Tretmans - 1996
Based on IO-Labeled Transition Systems
Conformance Testing
Conformance Testing - Soundness
Test suite is sound:
conformance ⇒ all tests pass
Conformance Testing - Soundness
Test suite is sound:
conformance ⇒ all tests pass
Conformance Testing - Exhaustiveness
Test suite is exhaustive:
conformance ⇐ all tests pass
Conformance Testing - Exhaustiveness
Test suite is exhaustive:
conformance ⇐ all tests pass
Conformance Testing - Completeness
Test suite is complete:
conformance ≡ all tests pass
Conformance Testing - Completeness
Test suite is complete:
conformance ≡ all tests pass
Conformance Testing with ioco
System (Implementation) is modeled as IOTS
weakly input enabledSpecification is an IOLTS
possibly incomplete possible non-deterministic!g1
τ τ
!g1 ?g2
?g2
!g3
!g3 !g1
Conformance Testing with ioco
System (Implementation) is modeled as IOTS
weakly input enabledSpecification is an IOLTS
possibly incomplete possible non-deterministic!g1
τ τ
!g1 ?g2
?g2
!g3
!g3 !g1
Input Output Labeled Transition Systems
Input Output Labeled Transition System
An IOLTS is an LTS M = (Q
M, A
M, →
M, q
0M) with Q
Ma finite set of states
A
M= A
MI∪ A
MO∪ {τ } where
AMI andAMO are input and output alphabets τ6∈AMI ∪AMO is an unobservable, internal action
→
M⊆ Q
M× A
M× Q
Mis the transition relation q
0M∈ Q
Mis the initial state.
QUESTION?
What means: The implementation conforms-to the
specification?
Input Output Labeled Transition Systems
Input Output Labeled Transition System
An IOLTS is an LTS M = (Q
M, A
M, →
M, q
0M) with Q
Ma finite set of states
A
M= A
MI∪ A
MO∪ {τ } where
AMI andAMO are input and output alphabets τ6∈AMI ∪AMO is an unobservable, internal action
→
M⊆ Q
M× A
M× Q
Mis the transition relation q
0M∈ Q
Mis the initial state.
QUESTION?
What means: The implementation conforms-to the
specification?
How to relate 2 LTSs?
Equivalence Relations (=)
BisimulationTrace Equivalence Testing Equivalence ...
Preorder Relations (≤)
Trace Preorder Testing Preorder ...Input-Output Relations
ioconfioco ...
...
(Weak) Bisimulation
Two states are bisimilar iff they simulate each other and go to states which are bisimilar
Bisimulation is not suited for testing!
Trace Equivalence
A trace is an observable sequence of actions
Two states are trace equivalent iff they have the same traces
Trace equivalence is the weakest notion of conformance
Equivalence vs. Preorder Relations
Equivalence Relation (R)
reflexive (sRs)symmetric: iRs→sRi transitive: iRs∧sRt →iRt
Preorder Relations (≤)
NOTnecessarily antisymmetric:
iRs↔i ≤s∧s≤i simplifies testing
e.g.: Trace Preorder
i ≤tr s↔traces(i)⊆traces(s)
Some Notations: Transitions
q →
aMq
0=
df(q, a, q
0) ∈→
Mq ⇒
q
0=
df(q = q
0) ∨ (q →
τ Mq
1∧ · · · ∧ q
n−1 τ→
Mq
0)
q ⇒
aq
0=
df∃q
1, q
2: q ⇒
Mq
1→
aMq
2⇒
Mq
0Some Notations: Quiescence
δ is used to represent quiescence
q−→δ q=dfq is a quiescent state.Quiescent state = no edge labeled with an output or an
internal action
Some Notations: Quiescence
δ is used to represent quiescence
q−→δ q=dfq is a quiescent state.Quiescent state = no edge labeled with an output or an
internal action
Some Notations: Suspension Automaton
∆(M) = (Q
M, A
∆(M), →
∆(M), q
0M) where:
A∆(M)=AM∪ {δ}withδ∈A∆(M)O
→∆(M)is obtained from→M by adding loopsq→δ qfor each quiescent state
Some Notations: After
q after
Mσ =
df{q
0| q ⇒
σMq
0} Q after
Mσ =
dfS
q∈Q
(q after
Mσ).
Some Notations: Out
Out
M(q) =
df{a ∈ A
MO| q →
aM} Out
M(Q) =
dfS
q∈Q
(Out
M(q))
ioco
Definition: ioco
Let IUT = (Q
IUT, A
IUT, →
IUT, q
0IUT) be weakly input enabled with A
IUT= A
IUTI∪ A
IUTO∪ {τ } and S = Q
S, A
S, →
S, q
0Sbe strongly responsive with A
S= A
SI∪ A
SO∪ {τ }. Then:
IUT ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(IUT ) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
IUT ioco S iff outputs (and quiescences) of the IUT are
possible in S after an arbitrary suspension trace of S.
ioco
Definition: ioco
Let IUT = (Q
IUT, A
IUT, →
IUT, q
0IUT) be weakly input enabled with A
IUT= A
IUTI∪ A
IUTO∪ {τ } and S = Q
S, A
S, →
S, q
0Sbe strongly responsive with A
S= A
SI∪ A
SO∪ {τ }. Then:
IUT ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(IUT ) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
IUT ioco S iff outputs (and quiescences) of the IUT are
possible in S after an arbitrary suspension trace of S.
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
P ioco S?
P ioco S =
df∀σ ∈ traces(∆(S)) :
Out
IUT(∆(P) after
IUTσ) ⊆ Out
S(∆(S) after
Sσ).
Test Cases
A test case is an IOLTS
Inputs = Outputs IUT, Outputs = Inputs IUT Equipped with verdict states (pass, fail) In each state (except Pass, Fail):
Single output and all inputs
All inputs andθ
Formal Test Execution
Formal Test Execution
Formal Test Execution
Formal Test Execution
Formal Test Execution
Formal Test Execution
Formal Test Execution
Formal Test Execution
Formal Test Execution
Formal Test Execution
Formal Test Execution
A Complete Test Generation Algorithm
Given the suspension automaton of a specification as an LTS S = (Q
S, A
S, →
S, q
0S)
1
Initially compute K = q
0Safter
S2
Do non-deterministically, either:
Stop test case with verdictpass
Let the test case produce an output (!a) with K0=K afterS?a6=∅.
Also accept all inputs at the same time and add fail states for unexpected results.
Accept all inputs (and quiescence) and add fail states for unexpected results. Compute newK0for valid inputs.
3