Real Tim e Testing
TRON TRON TRON TRON
Testing
W ith
using UPPAAL
W ith Mariius Mikucionis, Brian Nielsen, Arne Skou, Anders Hessel, Paul Pettersson, Jacob I llum Rasm ussen
Real Tim e TRON TRON TRON TRON Testing Testing using UPPAAL W - - PowerPoint PPT Presentation
Real Tim e TRON TRON TRON TRON Testing Testing using UPPAAL W ith W ith Mariius Mikucionis, Brian Nielsen, Arne Skou, Anders Hessel, Paul Pettersson, Jacob I llum Rasm ussen Overview Introduction gi knolog Off-line Test
W ith
using UPPAAL
W ith Mariius Mikucionis, Brian Nielsen, Arne Skou, Anders Hessel, Paul Pettersson, Jacob I llum Rasm ussen
Introduction
Off-line Test Generation
CLASSI C CLASSI C CLASSI C CLASSI C CORA CORA CORA CORA
CLASSI C CLASSI C CLASSI C CLASSI C CORA CORA CORA CORA TI GA TI GA TI GA TI GA
On-line Test Generation
TRON TRON TRON TRON
Conclusion and Future Work
Kim G Larsen 2 Summer School on Informatics RIO 2012
Primary validation technique used in industry
30 50 % f d l t ti d t i b dd d ft
To find errors
To determine risk of release Pa t of s stem de elopment life c cle
Part of system development life-cycle
Output
p Input
Expensive, error prone, time consuming (for Real-Time Systems)
UPPAAL model can be used to generate test specifications
Kim G Larsen 3 Summer School on Informatics RIO 2012
sensors
Continuous
Discrete
actuators
Conform s-to?
a 1 2 4 3 1 2
inputs
Test generation (offline or
c b 4 3 a c b 1 2 4 3 4 3 1 2 a
Design Model
c b 3 4 3 c b
Kim G Larsen 4 Summer School on Informatics RIO 2012
DBLclick!
pass
Test
Test Gene- rator
click? x:=0 x>=2 DBLclick!
fail
Test execution tool
Event
Test Generator tool
tool
click? x<2
a mapping Driver
tool Selection & ti i ti
Implementation Relation
Kim G Larsen 6 Summer School on Informatics RIO 2012
I nput Enabled: all inputs can always be accepted. Assumption about model of SUT
p y p Output Urgent: enabled outputs will occur immediately model of SUT
enabled outputs will occur immediately. Determ inism : two transitions with same input/output leads to the
two transitions with same input/output leads to the same state. I l t d O t t
I solated Outputs: if an output is enabled, no other output is enabled.
Kim G Larsen 7 Summer School on Informatics RIO 2012
System model System model
myGearControl.xml
Uppaal Model- Checker Trace (witness) Trace (witness)
Test purpose Property Test purpose Property Some Random Shortest
E<> Gear Gear5
Fastest
E<> Gear.Gear5 testGear5.trc
8 Summer School on Informatics RIO 2012
Kim G Larsen
Kim G Larsen 9 Summer School on Informatics RIO 2012
Test Purpose: A specific test objective (or observation) the tester wants to make on SUT
TP: Check that the light can become bright: E<> L==10
in(OSetLevel,1);silence(1000);in(OSetLevel,2); silence(1000); in(OSetLevel,3);silence(1000);in(OSetLevel,4);silence(1000); in(OSetLevel 5);silence(1000);in(OSetLevel 6);silence(1000); 10 Summer School on Informatics RIO 2012 in(OSetLevel,5);silence(1000);in(OSetLevel,6);silence(1000); in(OSetLevel,7);silence(1000);in(OSetLevel,8);silence(1000); in(OSetLevel,9);silence(1000);in(OSetLevel,10);
Kim G Larsen
Multi purpose testing
Cover measurement Examples:
Examples:
11 Summer School on Informatics RIO 2012 Kim G Larsen
Multi purpose testing
Cover measurement Examples:
Examples:
12 Summer School on Informatics RIO 2012 Kim G Larsen
Multi purpose testing
Cover measurement Examples:
Examples:
13 Summer School on Informatics RIO 2012 Kim G Larsen
Multi purpose testing
Cover measurement Examples:
Examples:
14 Summer School on Informatics RIO 2012 Kim G Larsen
Test sequence traversing all edges Encoding:
Encoding:
Check:
15 Summer School on Informatics RIO 2012
Time=12600 ms
silence(200);
//13
silence(500);//hold // ActiveUP+increase to level 10 silence(1000); in(OSetLevel,1); silence(1000); in(OSetLevel,2); silence(1000); in(OSetLevel,3);
( ); in(OSetLevel,0);
silence(200);
in(OSetLevel,0); // ( ); ( , ); silence(1000); in(OSetLevel,4); silence(1000); in(OSetLevel,5); silence(1000); in(OSetLevel,6); silence(1000); in(OSetLevel,7); silence(1000); in(OSetLevel,8); silence(1000); in(OSetLevel,9); silence(1000); in(OSetLevel,10
16 Summer School on Informatics RIO 2012
//9
silence(500); //hold //To Passive DN (level=0) in(OSetLevel,0);
silence(1000); in(OSetLevel,9); //bring dimm State to ActiveDN
silence(dfTolerance);
Page 1 Page 2
Kim G Larsen
Cost=320 J
1 W 5 L W 5 L W
5 · L W 5 · L W 1 W
silence(200);
//13
silence(500);//hold // ActiveUP+increase to level 10 silence(1000); in(OSetLevel,1); silence(1000); in(OSetLevel,2); silence(1000); in(OSetLevel,3);
( ); in(OSetLevel,0);
silence(200);
in(OSetLevel,0); // ( ); ( , ); silence(1000); in(OSetLevel,4); silence(1000); in(OSetLevel,5); silence(1000); in(OSetLevel,6); silence(1000); in(OSetLevel,7); silence(1000); in(OSetLevel,8); silence(1000); in(OSetLevel,9); silence(1000); in(OSetLevel,10
17 Summer School on Informatics RIO 2012
//9
silence(500); //hold //To Passive DN (level=0) in(OSetLevel,0);
silence(1000); in(OSetLevel,9); //bring dimm State to ActiveDN
silence(dfTolerance);
Page 1 Page 2
Kim G Larsen
Requirement spec.:
Requirement 2.1 When the user presses the button save, all user data is saved to the
database are output to the screen Requirement 2.1 When the user presses the button save, all user data is saved to the database The values stored in the Requirement 2.1 When the user presses the button save all user data is saved to the Requirement 2.1 When the user presses the button
database are output to the screen save, all user data is saved to the
database are output to the screen When the user presses the button save, all user data is saved to the
database are output to the screen
Generate Covering Test Suite:
18 Summer School on Informatics RIO 2012
Kim G Larsen
19 Summer School on Informatics RIO 2012 Kim G Larsen
Kim G Larsen 20 Summer School on Informatics RIO 2012
Build functional model as UML state m achines
w Jacob Illum Rasmussen, Arne Skou
as UML state m achines using Rational Systems Developer from IBM
Arne Skou Formal Methods 2009
Generate edge coverage test using Yggdrasil
XMI-to-TA XMI
Output tests from Yggdrasil to JavaScript
Yggdrasil to JavaScript
(QTP, Selenium, Ruby)
Execute scripts
Kim G Larsen 21 Summer School on Informatics RIO 2012
Determ inism :
I nput Enabled:
I nput Enabled:
Tim e Uncertainty of outputs:
Uncontrollable output:
Kim G Larsen 23 Summer School on Informatics RIO 2012
Tidle=20 Tsw=4
Kim G Larsen 24 Summer School on Informatics RIO 2012
Tidle=20 Tsw=4
Tsw 4
How to test for Bright ?
How to test for Bright ?
E<> (control: A<> Bright)
<<c,u>> ♦(<<c>> ♦ Bright)
Kim G Larsen 25 Summer School on Informatics RIO 2012
Model Statespace
winning possibly winning
initial goal
loosing
Kim G Larsen 26 Summer School on Informatics RIO 2012
Kim G Larsen 28 Summer School on Informatics RIO 2012
DBLclick!
pass
Test
Test Gene- rator
click? x:=0 x>=2 DBLclick!
fail
Test execution tool
Ad t
Test Generator tool
tool
click? x<2
a Adaptor
tool Selection & ti i ti
Correctness Relation
Kim G Larsen 29 Summer School on Informatics RIO 2012
DBLclick!
pass
Test
Test Gene- rator
click? x:=0 x>=2 DBLclick!
input fail
Test execution tool
Ad t
Test Generator tool
input input input
tool
click? x<2
a Adaptor
tool
Selection & ti i ti
Correctness Relation
by event (randomly) by-event (randomly)
Kim G Larsen 30 Summer School on Informatics RIO 2012
mousePress
LightControllerGUI Test Fixture UPPAALTRON tcp/ip mousePress mouseRelease
g Fixture UPPAALTRON Testing Host release grasp release grasp setLevel setLevel
LightController
31 Summer School on Informatics RIO 2012
JavaVM+w2k/Linux
Kim G Larsen
Mutant: Non-conforming program version
synchronized public void handleTouch() {
if(lightState==lightOff) { setLevel(oldLevel); lightState=lightOn; }
} else { //was missing if(lightState==lightOn){
setLevel(0); lightState=lightOff; }
32 Summer School on Informatics RIO 2012 Kim G Larsen
Dynamically compute all potential states that the
Dynamically compute all potential states that the
[Tripakis] Failure Diagnosis
Z= M after (0,i0,1,o1,2,i2,o2)
If Z= the IUT has made a computation not in model:
FAI L
i is a relevant input in Env iff I ∈ EnvOutput(Z)
Kim G Larsen 34 Summer School on Informatics RIO 2012
Timed Automata S ifi ti
Specification
4
System Under Test
8
Test
Kim G Larsen 35 Summer School on Informatics RIO 2012
Algorithm TestGenExe (S, E, IUT, T ) returns {pass, fail) Z := {(s0, e0)}. w hile Z and ♯iterations ≤ T do either randomly:
w hile Z and ♯iterations ≤ T do either randomly: 1. // offer an input if EnvOutput(Z) randomly choose i∈ EnvOutput(Z) d i t IUT
send i to IUT Z := Z After i 2. // wait d for an output randomly choose d∈ Delays(Z)
w ait (for d time units or output o at d′ ≤ d) if o occurred then Z := Z After d′ Z := Z After o // may become (fail)
Z : Z After o // may become (fail) else Z := Z After d // no output within d delay 3. restart: Z := {(s0 e0)} reset IUT //reset and restart Z := {(s0, e0)}, reset IUT //reset and restart if Z = then return fail else return pass
Kim G Larsen 36 Summer School on Informatics RIO 2012
Algorithm TestGenExe (S, E, IUT, T ) returns {pass, fail) Z := {(s0, e0)}. w hile Z ♯iterations ≤ T do either randomly:
w hile Z ♯iterations ≤ T do either randomly: 1. // offer an input if EnvOutput(Z) randomly choose i EnvOutput(Z) d i t IUT
send i to IUT Z := Z After i 2. // wait d for an output randomly choose d Delays(Z)
(Under some technical
w ait (for d time units or output o at d′ ≤ d) if o occurred then Z := Z After d′ Z := Z After o // may become (fail)
(Under some technical assumptions)
Z : Z After o // may become (fail) else Z := Z After d // no output within d delay 3. restart: Z := {(s0 e0)} reset IUT //reset and restart Z := {(s0, e0)}, reset IUT //reset and restart if Z = then return fail else return pass
Kim G Larsen 37 Summer School on Informatics RIO 2012
Z after a: possible states after action a (and * ) Z after :possible states after * and i , totaling a delay of
a
Z
Z
a
time
(5)
Can be computed efficiently using the
Kim G Larsen 38 Summer School on Informatics RIO 2012
Kim G Larsen 39 Summer School on Informatics RIO 2012
Kim G Larsen 40 Summer School on Informatics RIO 2012
Kim G Larsen 41 Summer School on Informatics RIO 2012
Kim G Larsen 42 Summer School on Informatics RIO 2012
Kim G Larsen 43 Summer School on Informatics RIO 2012
Kim G Larsen 44 Summer School on Informatics RIO 2012
Kim G Larsen 45 Summer School on Informatics RIO 2012
Kim G Larsen 46 Summer School on Informatics RIO 2012
Kim G Larsen 47 Summer School on Informatics RIO 2012
Kim G Larsen 48 Summer School on Informatics RIO 2012
Kim G Larsen 49 Summer School on Informatics RIO 2012
Kim G Larsen 50 Summer School on Informatics RIO 2012
Kim G Larsen 51 Summer School on Informatics RIO 2012
Danfoss Electronic Cooling Controller
Sensor I nput i t t
Keypad I nput
Output Relays yp p
parameters)
( y) Display Output
Kim G Larsen 52 Summer School on Informatics RIO 2012
Kim G Larsen 53 Summer School on Informatics RIO 2012
Danfoss Electronic Cooling Controller
Sensor I nput i t t
Keypad I nput
Output Relays yp p
parameters)
( y) Display Output
Kim G Larsen 54 Summer School on Informatics RIO 2012
3700 3800
2900 3000 3100 3200 3300 3400 3500 3600 3700 setTemp modelTemp ekcTemp CON COFF
2200 2300 2400 2500 2600 2700 2800 2900 COFF AON AOFF alarmRst HADOn HADOff DON
1500 1600 1700 1800 1900 2000 2100 100000 200000 300000 400000 500000 600000 700000 800000 900000 DON DOFF manDefrostOn manDefrostOff
100000 200000 300000 400000 500000 600000 700000 800000 900000
defrostOff? alarm On! resetAlarm ? AOFF! HighAlarm DisplayOff! / / defrost com plete DOFF! CON! alarm On! alarm DisplayOn! m anualDefrostOn? COFF! DON! com pressorOn!
Kim G Larsen 55 Summer School on Informatics RIO 2012
Engineer focus on w hat to test at a high
Avoids cost of making scripts
Heard of, but is still considered an
Heard of, but is still considered an
Industry is very motivated, MB A&T will
Kim G Larsen 57 Summer School on Informatics RIO 2012
Checks the actual
Abstract models
Checks the actual
Only few Abstract models Exhaustive “proof”
Only few
But is the most Limited size and
But is the most
Kim G Larsen 58 Summer School on Informatics RIO 2012
Testing real-time systems is theoretically
Promising techniques and tools Explicit environment modeling
Real-time online testing from timed
Kim G Larsen 59 Summer School on Informatics RIO 2012
Testing Theory Timed games with partial observability
Hybrid extensions Other Quantitative Properties
Probabilistic Extensions, Performance testing Efficient data structures and algorithms for state
Diagnosis & Debugging Guiding and Coverage Measurement
Real-Time execution of TRON Adaptor Abstraction, IUT clock synchronization Further Industrial Cases
Kim G Larsen 60 Summer School on Informatics RIO 2012
Formal Testing Frameworks
Real-Time Implementation Relations
Symbolic Reachability analysis of Timed
]
Online state-set computation
Online Testing
Kim G Larsen 61 Summer School on Informatics RIO 2012