black-box conformance testing for real-time systems
DESCRIPTION
Black-box conformance testing for real-time systems. Stavros Tripakis VERIMAG Joint work with Moez Krichen. black box. inputs. outputs. Tester. Verdicts (pass/fail/?). Black-box conformance testing. Does the SUT conform to the Specification ?. SUT (system under test). Specification. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/1.jpg)
1
Black-box conformance testing for real-time systems
Stavros Tripakis
VERIMAG
Joint work with Moez Krichen
![Page 2: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/2.jpg)
2
Black-box conformance testing
Specification
SUT(system under
test)
Tester
outputs
Verdicts (pass/fail/?)
inputs
Does the SUT conformto the Specification ?
blackbox
![Page 3: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/3.jpg)
3
Model-based testing
• The specification is given as a formal model.
• The SUT also behaves according to an unknown model (black-box).
• Conformance of SUT to the specification is formally defined w.r.t. these models.
![Page 4: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/4.jpg)
4
Real-time Testing
SUT
Tester
outputs
Verdicts(pass/fail)
inputs
Tester observes events and time-stamps.
Our models of preference
Theory: timed automata
Practice: the IF language(www-verimag.imag.fr/~async/IF/)
![Page 5: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/5.jpg)
5
Plan of talk
• Specification model
• Conformance relation
• Analog & digital tests
• Test generation
• Tool and case studies
![Page 6: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/6.jpg)
6
Plan of talk
• Specification model
• Conformance relation
• Analog & digital tests
• Test generation
• Tool and case studies
![Page 7: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/7.jpg)
7
Specification model:general timed automata with
input/output/unobservable actions
• Timed automata = finite-state machines + clocks.
• Input/output actions: interface with environment and tester.
• Unobservable actions:– Model partial observability of the tester.– Good for compositional specifications.
![Page 8: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/8.jpg)
8
Simple example 1
a?x:=0 x 4
b!
“Output b at most 4 time units after receiving input a.”
![Page 9: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/9.jpg)
9
Compositional specifications
Compositional specificationswith internal (unobservable) actions.
A B
C
![Page 10: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/10.jpg)
10
Compositional specifications
internal (unobservable) actions.
![Page 11: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/11.jpg)
11
Modeling assumptions on the environment
system (spec)
Compose the specification witha model of the environment.
environment
Export the interactions between them(make them observable).
![Page 12: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/12.jpg)
12
Simple example 2
a?x 10 x 4
b!
“Output b at most 4 time units after receiving input a,provided a is received no later than 10 time units.”
Constraints on the inputs model assumptions.
x:=0x:=0
Constraints on the outputs model requirements.
![Page 13: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/13.jpg)
13
Simple example 2
a!y 10
“Output b at most 4 time units after receiving input a,provided a is received no later than 10 time units.”
A compositional modeling of the same example.
y:=0
a?x:=0 x 4
b!a? b!
![Page 14: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/14.jpg)
14
Plan of talk
• Specification model
• Conformance relation
• Analog & digital tests
• Test generation
• Tool and case studies
![Page 15: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/15.jpg)
15
Conformance relation: tioco• A timed extension of Tretman’s ioco (input-
output conformance relation).
• Informally, A tioco B if– Every output of the implementation is allowed by
the specification, including time delays.
• A: implementation/SUT (input-complete).• B: specification (not always input-complete
( model environment assumptions).
![Page 16: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/16.jpg)
16
Conformance relation• Formally:
A tioco B (A: implementation, B:specification)iff
Traces(B). out(A after ) out(B after )
![Page 17: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/17.jpg)
17
Conformance relation• where:
A after = {s | Seq. s0 s proj(,Obs)=}
out(S) = delays(S) outputs(S)
![Page 18: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/18.jpg)
18
Conformance relation• where:
outputs(S) = {aOutputs | sS . s }a
delays(S) ={tR | sS. UnobsSeq. time() = t s }
![Page 19: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/19.jpg)
19
Examples“Output b at most 4 time units after receiving input a.”
a?x:=0 x 4
b!Spec:
![Page 20: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/20.jpg)
20
Examples“Output b at most 4 time units after receiving input a.”
a?x:=0 x 4
b!Spec:
a?x:=0 x = 4
b!Impl 1:
![Page 21: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/21.jpg)
21
Examples“Output b at most 4 time units after receiving input a.”
a?x:=0 x 4
b!Spec:
a?x:=0 x = 4
b!Impl 1: OK!
![Page 22: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/22.jpg)
22
Examples“Output b at most 4 time units after receiving input a.”
a?x:=0 x 4
b!Spec:
a?x:=0 x = 4
b!Impl 1:
a?x:=0 x 2
b!Impl 2:
OK!
![Page 23: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/23.jpg)
23
Examples“Output b at most 4 time units after receiving input a.”
a?x:=0 x 4
b!Spec:
a?x:=0 x = 4
b!Impl 1:
a?x:=0 x 2
b!Impl 2:
OK!
OK!
![Page 24: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/24.jpg)
24
Examples“Output b at most 4 time units after receiving input a.”
a?x:=0 x 4
b!Spec:
a?x:=0 x = 5
b!Impl 3:
![Page 25: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/25.jpg)
25
Examples“Output b at most 4 time units after receiving input a.”
a?x:=0 x 4
b!Spec:
a?x:=0 x = 5
b!Impl 3: NOT OK!
![Page 26: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/26.jpg)
26
Examples“Output b at most 4 time units after receiving input a.”
a?x:=0 x 4
b!Spec:
a?x:=0 x = 5
b!Impl 3:
a?Impl 4:
NOT OK!
![Page 27: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/27.jpg)
27
Examples“Output b at most 4 time units after receiving input a.”
a?x:=0 x 4
b!Spec:
a?x:=0 x = 5
b!Impl 3:
a?Impl 4:
NOT OK!
NOT OK!
![Page 28: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/28.jpg)
28
Plan of talk
• Specification model
• Conformance relation
• Analog & digital tests
• Test generation
• Tool and case studies
![Page 29: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/29.jpg)
29
Timed tests• Two types of tests:• Analog-clock tests:
– Can measure real-time precisely– Difficult to implement for real-time SUTs– Good (flexible) for discrete-time SUTs with
unknown time step
• Digital-clock tests:– Can count “ticks” of a periodic clock/counter– Implementable for any SUT– Conservative (may say PASS when it’s FAIL)
![Page 30: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/30.jpg)
30
Timed tests• Analog-clock tests:
– They can observe real-time precisely, e.g.:
• Digital-clock (or periodic-sampling) tests: – They only have access to a periodic clock, e.g.:
ba
1.3 2.4 2.7
c
time
ba c
time1 2 3
![Page 31: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/31.jpg)
31
Timed tests• Analog-clock tests:
– They can observe real-time precisely, e.g.:
• Digital-clock (or periodic-sampling) tests: – They only have access to a periodic clock, e.g.:
ba
1.3 2.4 2.7
c
time
ba c
time1 2 3
![Page 32: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/32.jpg)
32
Note
• Digital-clock tests does not mean we discretize time:– The specification is still dense-time– The capabilities of the observer are discrete-time )– Many dense-time traces will look the same to the
digital observer (verdict approximation)
![Page 33: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/33.jpg)
33
Plan of talk
• Specification model
• Conformance relation
• Analog & digital tests
• Test generation
• Tool and case studies
![Page 34: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/34.jpg)
34
Untimed tests• Can be represented as finite trees (“strategies”):
i
o1 o2 o3 o4
faili1 i2 i3
……
failpass
![Page 35: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/35.jpg)
35
Digital-clock tests• Can be represented as finite trees:
i
o1 o2 o3 o4 tick
fail …i1 i2 i3
……
failpass
Models the tick ofthe tester’s clock
![Page 36: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/36.jpg)
36
Analog-clock tests• Cannot be represented as finite trees:
i
o1 o2 o3 o4 0.1
faili1 i2 i3
……
failpass
0.11 0.2…
Infinite number ofunknown delays
Solution: on-the-fly testing
![Page 37: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/37.jpg)
37
On-the-fly testing
• Generate the testing strategy during test execution.
• Symbolic generation.
• Can be applied to digital-clock testing as well.
![Page 38: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/38.jpg)
38
Test generation principle
currentestimate
=set of possible states
of specification
observation
(event or delay)
nextestimate
runs matchingobservation
If empty,FAIL.
![Page 39: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/39.jpg)
39
Test generation algorithmics• Sets of states are represented symbolically
(standard timed automata technology, DBMs, etc.)
• Updates amount to performing some type of symbolic reachability.
• Implemented in verification tools, e.g., Kronos.
• IF has more: dynamic clock creation/deletion, activity analysis, parametric DBMs, etc.
![Page 40: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/40.jpg)
40
Digital-clock test generation• Can be on-the-fly or static.• Same algorithms.• Trick:
• Generate “untimed” tester: tick is observable. • Can also model skew, etc, using other “Tick”
automata.
“Tick”tick!z = 1z:= 0
originalspecificationautomaton
newspecificationautomaton
![Page 41: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/41.jpg)
41
Recent advances• Representing analog-clock tests as timed
automata.
• Coverage criteria.
![Page 42: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/42.jpg)
42
Timed automata testers• On-the-fly testing needs to be fast:
– Tester reacts in real-time with the SUT.– BUT: reachability can be costly.– Can we generate a timed automaton tester ?
• Problem undecidable in general:– Non-determinizability of timed automata.
• Pragmatic approach:– Fix the number of clocks of the tester.– Fix their reset positions.– Synthesize the rest: locations, guards, etc.
![Page 43: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/43.jpg)
43
Timed automata testers• Example:
a?x:=0 1 x 4
b!Spec:
a!x=1
Tester:
x > 4b?
x < 1
FAIL
PASS1 x 4
b?
![Page 44: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/44.jpg)
44
Coverage• A single test is not enough.• Exhaustive test suite up to given depth:
– Explosion: # of tests grows exponentially!
• Coverage: few tests, some guarantees.• Various criteria:
– Location: cover locations of specification.– Edge: cover edges of specification.– State: cover states (location,clocks) of spec.
• Algorithms:– Based on symbolic reachability graph.– Performance can be impressive: 8 instead of 15000
tests.
![Page 45: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/45.jpg)
45
Plan of talk
• Specification model
• Conformance relation
• Analog & digital tests
• Test generation
• Tool and case studies
![Page 46: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/46.jpg)
46
Implementation• Implemented on top of IF environment.
TTG: TimedTest Generation
![Page 47: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/47.jpg)
47
Tool• Input language: IF timed automata
– Dynamic creation of processes/channels.– Synchronous/asynchronous communication.– Priorities, variables, buffers, external data
structures, etc.
• Tool options:– Generate analog tester (or monitor).– Generate digital test/monitor suite:
• Interactively (user guided).• Exhaustive up to given length.• Coverage (current work).
![Page 48: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/48.jpg)
48
Real-time Monitoring/Testing
SUT
Tester
outputs
Verdicts(pass/fail)
inputs
SUT
Monitor
outputs
Verdicts(pass/fail)
![Page 49: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/49.jpg)
49
A sample testgenerated by
TTG
![Page 50: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/50.jpg)
50
Case studies
• A bunch of simple examples tried out– A simple light controller.– 15000 digital tests up to depth 8.– 8 tests suffice to cover specification.
• A larger example: NASA K9 Rover executive.– SUT: 30000 lines of C++ code.– TA specification generated automatically from
mission plans.– Monitors generated automatically from TA specs.– Traces generated by NASA and tested by us.
![Page 51: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/51.jpg)
51
Papers
1. Krichen, Tripakis, “Black-box conformance testing for real-time systems”, SPIN’04, LNCS 2989.
2. Bensalem, Bozga, Krichen, Tripakis, “Testing conformance of real-time applications by automatic generation of observers”, Runtime Verification’04, ENTCS.
3. Krichen, Tripakis, “Real-time testing with timed automata testers and coverage criteria”, submitted.
![Page 52: Black-box conformance testing for real-time systems](https://reader035.vdocuments.site/reader035/viewer/2022062423/56814986550346895db6cdfa/html5/thumbnails/52.jpg)
52
merci !
des questions ?