SlideShare a Scribd company logo
.lusoftware veriïŹcation & validation
VVS
Effective Test Suites for !
Mixed Discrete-Continuous
StateïŹ‚ow Controllers
Reza Matinnejad
Shiva Nejati
Lionel Briand

SnT Center, University of Luxembourg

Thomas Bruckmann

Delphi Automotive Systems, Luxembourg
Cyber Physical Systems (CPSs)
Combination of computations (algorithms) and physical
dynamics (differential equations)

2
Physical world
 Computation
Testing (Typical) Software
3
X = 10, Y = 30
Z = 20
Algorithms
Fail
Pass
Z = 10
Testing (CPS) Software 
4
Algorithms + 
Differential Equations
Fail
Z = 20
X = 10, Y = 30
S1(t)
S2(t)
S3(t)
Pass
Z = 20
 S3(t)
S1
t
S2
t
S3
t
S3
t
Software Testing Challenges (CPS)
‱ Mixed discrete-continuous behavior (combination of
algorithms and continuous dynamics) 
‱ Inputs/outputs are signals (functions over time)
‱ Simulation is inexpensive but not yet systematically
automated
‱ Partial test oracles
5
Generating effective test suites
for Software used in !
Cyber-Physical Systems
6
Our Goal
Simulink/StateïŹ‚ow
‱ A data ïŹ‚ow-driven block diagram language
‱ Is widely used to develop Cyber Physical Systems
‱ Is executable
7
StateïŹ‚ow
‱ A Statechart dialect integrated into Simulink
‱ Captures the state-based behavior of CPS software
‱ Has mixed discrete-continuous behavior
8
Generating effective test suites
for mixed discrete-continuous
StateïŹ‚ow controllers
9
Our Goal
Discrete Behavior
What we typically think of software models
10
On
Off
On
Off
Speed < 10 Speed > 10
Discrete-Continuous Behavior
What software models are actually being built using StateïŹ‚ow
11
On
Off
CtrlSig
On
Off
Speed < 10 Speed > 10
t
CtrlSig
t
CtrlSig
Generating effective test suites
for mixed discrete-continuous
StateïŹ‚ow controllers
12
Our Goal
Test Suite Effectiveness (1)
‱  Test suite size should be small because
‱  Test oracles cannot be fully automated
‱  Output signals need to be inspected by engineers
13
Model
Simulation
Input
Signals
Output
Signal(s)
S3
t
S2
t
S1
t
S3
t
S2
t
S1
t
Test Case 1
Test Case 2
Test Suite Effectiveness (2)
‱  Test suites should have a high fault revealing power
‱  Small deviations in outputs may not be recognized/important
‱  Test inputs that drastically impact the output signal shape are
likely to have a higher fault revealing power 
14
Test Output 1
TimeTime
CtrlSig
Faulty Model Output
Correct Model Output
Test Output 2
Test Generation Algorithms!
!

15
Our Approach
Test Generation Algorithms
‱  Input-based Test Generation:
‱  Input Diversity Algorithm
‱  Coverage-based Test Generation:
‱  State Coverage Algorithm
‱  Transition Coverage Algorithm
‱  Output-based Test Generation:
‱  Output Diversity Algorithm
‱  Failure-based Algorithm
16
Input Diversity
‱ Maximizing distances among input signals
17
Test Case 1
Test Case 2
Input Signal 1
 Input Signal 2
S1
t
S1
t
S2
t
S2
t
Distance Between Signals
18
Time
Signal
Test Generation Algorithms
‱  Input-based Test Generation:
‱  Input Diversity Algorithm
‱  Coverage-based Test Generation:
‱  State Coverage Algorithm
‱  Transition Coverage Algorithm
‱  Output-based Test Generation:
‱  Output Diversity Algorithm
‱  Failure-based Algorithm
19
Structural Coverage
‱ Maximizing the number of states/transitions covered
20
State Coverage
 Transition Coverage
1
4
2
3
1
4
2
3
Test Generation Algorithms
‱  Input-based Test Generation:
‱  Input Diversity Algorithm
‱  Coverage-based Test Generation:
‱  State Coverage Algorithm
‱  Transition Coverage Algorithm
‱  Output-based Test Generation:
‱  Output Diversity Algorithm
‱  Failure-based Algorithm
21
Output Diversity
‱ Maximizing distances among output signals
22
Test Case 1
Test Case 2
Output Signal
S3
t
S3
t
Failure-based Test Generation 
23
Instability
 Discontinuity
0.0 1.0 2.0
-1.0
-0.5
0.0
0.5
1.0
Time
CtrlSigOutput
‱ Maximizing the likelihood of presence of speciïŹc failure
patterns in output signals
0.0 1.0 2.0
Time
0.0
0.25
0.50
0.75
1.0
CtrlSigOutput
We developed our failure-based
test generation algorithm using!
Meta-Heuristic Search 
24
The Alternative Choice
25
Our ApproachExisting WorkTechnique
Model
Checking
- Require precisely deïŹned
oracles (user-speciïŹed
assertions)
- Have been largely applied
to time-discrete models
- State-explosion problem!
- No need for automated test
oracles
- Applicable to time-continuous
and non-linear models
- Our algorithms are black-box
randomized search:
- non-memory intensive
- can be parallelized
26
Failure-based Test Generation
using Meta-Heuristic Search
Input Signals
Slightly Modifying
Each Input Signal
Fitness Functions 
Capturing the Likelihood
of Presence of Failure Patterns
in the Output Signals
Repeat
Until maximum resources spent
S Initial Candidate Solution
Search Procedure
R Tweak (S)
if Fitness (R) > Fitness (S)
S R
Return S
Output Stability !
Fitness Function
‱ Sum of the differences of signal values for consecutive
simulation steps
27
stability(sgo) =
kP
i=1
|sgo(i · t) sgo((i 1) · t)|
0.0 1.0 2.0
-1.0
-0.5
0.0
0.5
1.0
Time
CtrlSigOutput
Output Continuity !
Fitness Function
28
‱ Maximum of the minimum left or right derivatives for all the
simulation steps 
0.0 1.0 2.0
Time
0.0
0.25
0.50
0.75
1.0
CtrlSigOutput
continuity(sgo) =
K 1
max
i=1
(min(|LeftDer(sgo, i)|, |RightDer(sgo, i)|))
Comparing the!
Test Generation Algorithms!
!

29
Evaluation
Research Questions
‱  RQ1 (Fault Revealing Ability)
‱  RQ2 (Fault Revealing Subsumption)
‱  RQ3 (Test Suite Size)
30
Experiment Setup
‱ Three StateïŹ‚ow models: two industrial and one publicly
available case study
31
75 (faulty models) * 100 (algorithm runs)
*6 (generation algorithms) * 5 (different test suite sizes) =
225,000 test suites (in total)
Test Suite
(size=3,5,
10,25,50)
{
1.Fault
Seeding
2.Generation
Algorithm
SF
Faulty
SF
{75 75
Research Question 1!
Fault Revealing Ability
How does the fault revealing ability of
our proposed test generation algorithms
compare with one another?
32
1.0
0.0
0.5
Input
Diversity
Output
Diversity
Fault
Revealing
Rate
RQ1: Fault Revealing Ability
33
1.  Output-based and coverage-based algorithms outperformed
the input diversity algorithm
2.  Output-based algorithms outperformed the coverage-based
algorithms
3.  Overall, output stability algorithm performed the best
Research Question 2!
Fault Revealing Subsumption
Is any of our generation algorithms
subsumed by other algorithms? 
34
RQ2: Fault Revealing Subsumption
35
‱  For each of the 75 faulty models, we identiïŹed the best generation
algorithm(s) for different test suite sizes (5, 10, 25, and 50)
Fault 1
State Coverage
Transition Coverage
Output Diversity
Output Stability
Output Continuity
Fault 2 Fault 3 Fault 4
RQ2: Fault Revealing Subsumption (2)
36
1.  The coverage-based algorithms found the least
number of faults
2.  Coverage-based algorithms are subsumed by
output diversity algorithm when the test suite size
increases (size = 25 , 50)
Research Question 3!
Test Suite Size
What is the impact of the size of test suites
generated by our generation algorithms on
their fault revealing ability? 
37
RQ3: Test Suite Size
38
1.  The fault revealing rates for output stability/continuity is very
high for small test suites(size = 3,5) for Instability/Discontinuity
failures
2.  For Other failures, the ability of output diversity in revealing
failures rapidly increases as the test suite size increases
DiscontinuityInstability Others
0.0
0.5
1.0
3 5 10 25 50
Test Suite Size
FaultRevealingRateMean
3 5 10 25 50 3 5 10 25 50
Output Stability
Ouput Continuity State Coverage
Transition CoverageOutput Diversity
Lessons Learned
39
Lesson 1!
Coverage-based algorithms are less
effective than output-based algorithms
‱  The test cases resulting from state/transition coverage
algorithms cover the faulty parts of the models
‱  97% state coverage and 81% transition coverage
‱  Cover faulty parts for 73 (out of 75) fault-seeded models
‱ However, they fail to generate output signals that are
sufïŹciently distinct from the oracle signal, hence yielding a
low fault revealing rate 
40
Lesson 2!
Combining Output-based Algorithms
41
‱  We suggest to divide the test suite size budget between
output-based algorithms:
Output Continuity
 Output Stability
 Output Diversity
CoCoTest
42
.lusoftware veriïŹcation & validation
VVS
Effective Test Suites for !
Mixed Discrete-Continuous
StateïŹ‚ow Controllers
Reza Matinnejad (reza.matinnejad@uni.lu)
Shiva Nejati
Lionel Briand

SnT Center, University of Luxembourg

Thomas Bruckmann

Delphi Automotive Systems, Luxembourg
Lesson 1!
Combing Output-based Algorithms
‱  We suggest to divide the test suite size budget between
output stability, output continuity, and output diversity:
1.  Allocate a small part of the test budget to output
continuity 
2.  Share the rest of the budget between output stability
and output diversity, by giving output diversity a higher
share
44
Input / Output Vectors
45
0 5 10
50
150
250
FuelLevelSensor
FuelLevel
0 5 10
100.0
91.43
84.43
75.62
70.01
66.19
61.21
56.66
54.32
52.81
50
100
Time (s) Time (s)
Study subjects
46
Publicly
Available
Name
No. of
Inputs
Hierarchical
States
Parallelism
No. of
States
SCPC
ASS
No
No
23
42
13
16
2 No
1 No
GCS Yes 8 10 0 Yes
No. of
Transitions
25
53
27
‱ SCPC: Supercharger Clutch Position Controller
‱ ASS: Auto Start Stop Control
‱ GCS: Guidance Control System
Fault Revealing Rate (FRR)
47
FRR(SF, TS) =
(
1 91ïŁżiïŁżq
ˆdist(sgi, gi) > THR
0 81ïŁżiïŁżq
ˆdist(sgi, gi) <= THR
‱  FRR based on gi, output of the fault-free model, sgi, output of the fault-
seeded model, and a threshold THR:
1.  For continuous dynamic systems, the system output is acceptable
when the deviation is small and not necessarily zero 
2.  It is more likely that manual testers recognize a faulty output signal
when the signal shape drastically differs from the oracle.
RQ3: Test Suite Size
48
1.  The fault revealing rates for output stability/continuity is
very high for small test suites for Instability/Discontinuity
2.  For “Other” failures, the ability of OD in revealing failures
rapidly increases as the test suite size increases
Discontinuity
SC
TC
OD
OS
OC
* *
+ +
--
Instability Others
0.0
0.5
1.0
3 5 10 25 50
*
*
* *
+
+
+
-
-
Test Suite Size
FRRMean
+
-
-
3 5 10 25 50 3 5 10 25 50
* * *
-
-
-
+
+
+
-
- -
*
*
*
+
+
+
+
+
*
*
*-
-
-

More Related Content

PDF
Search-Based Robustness Testing of Data Processing Systems
PDF
Automated Test Suite Generation for Time-Continuous Simulink Models
PDF
Combining genetic algoriths and constraint programming to support stress test...
PDF
Change Impact Analysis for Natural Language Requirements
PDF
Testing Dynamic Behavior in Executable Software Models - Making Cyber-physica...
PDF
Applying Product Line Use Case Modeling ! in an Industrial Automotive Embedde...
PDF
Testing of Cyber-Physical Systems: Diversity-driven Strategies
PDF
Incremental Reconfiguration of Product Specific Use Case Models for Evolving ...
Search-Based Robustness Testing of Data Processing Systems
Automated Test Suite Generation for Time-Continuous Simulink Models
Combining genetic algoriths and constraint programming to support stress test...
Change Impact Analysis for Natural Language Requirements
Testing Dynamic Behavior in Executable Software Models - Making Cyber-physica...
Applying Product Line Use Case Modeling ! in an Industrial Automotive Embedde...
Testing of Cyber-Physical Systems: Diversity-driven Strategies
Incremental Reconfiguration of Product Specific Use Case Models for Evolving ...

What's hot (20)

PDF
Testing the Untestable: Model Testing of Complex Software-Intensive Systems
PDF
Improving Fault Localization for Simulink Models using Search-Based Testing a...
PDF
Documented Requirements are not Useless After All!
PDF
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...
PDF
PUMConf: A Tool to Configure Product Specific Use Case and Domain Models in a...
PDF
Automated Change Impact Analysis between SysML Models of Requirements and Design
PDF
Extracting Domain Models from Natural-Language Requirements: Approach and Ind...
PDF
Test Case Prioritization for Acceptance Testing of Cyber Physical Systems
PDF
Requirements in Cyber-Physical Systems: Specifications and Applications
PDF
System Testing of Timing Requirements based on Use Cases and Timed Automata
PDF
HITECS: A UML Profile and Analysis Framework for Hardware-in-the-Loop Testing...
PDF
Automated Testing of Autonomous Driving Assistance Systems
PDF
Metamorphic Security Testing for Web Systems
PDF
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
PDF
Automated Testing of Autonomous Driving Assistance Systems
PDF
Applications of Machine Learning and Metaheuristic Search to Security Testing
PDF
Approximation-Refinement Testing of Compute-Intensive Cyber-Physical Models: ...
PDF
Known XML Vulnerabilities Are Still a Threat to Popular Parsers ! & Open Sour...
PDF
Mining Assumptions for Software Components using Machine Learning
PDF
Model-driven trace diagnostics for pattern-based temporal specifications
Testing the Untestable: Model Testing of Complex Software-Intensive Systems
Improving Fault Localization for Simulink Models using Search-Based Testing a...
Documented Requirements are not Useless After All!
Evaluating Model Testing and Model Checking for Finding Requirements Violatio...
PUMConf: A Tool to Configure Product Specific Use Case and Domain Models in a...
Automated Change Impact Analysis between SysML Models of Requirements and Design
Extracting Domain Models from Natural-Language Requirements: Approach and Ind...
Test Case Prioritization for Acceptance Testing of Cyber Physical Systems
Requirements in Cyber-Physical Systems: Specifications and Applications
System Testing of Timing Requirements based on Use Cases and Timed Automata
HITECS: A UML Profile and Analysis Framework for Hardware-in-the-Loop Testing...
Automated Testing of Autonomous Driving Assistance Systems
Metamorphic Security Testing for Web Systems
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
Automated Testing of Autonomous Driving Assistance Systems
Applications of Machine Learning and Metaheuristic Search to Security Testing
Approximation-Refinement Testing of Compute-Intensive Cyber-Physical Models: ...
Known XML Vulnerabilities Are Still a Threat to Popular Parsers ! & Open Sour...
Mining Assumptions for Software Components using Machine Learning
Model-driven trace diagnostics for pattern-based temporal specifications
Ad

Viewers also liked (20)

PPT
Week 10 part2 pe 6282
PPTX
Programming logic controllers (plc) seminar
PPT
Lecture 07 mechatronic design concepts
PPTX
Design+of+mechatronics+system+&+control+of+sb w+system
PPTX
Programmable Logic Controller and ladder logic programming
PDF
218001 control system technology lecture 1
PPTX
Case studies powerpoint
DOCX
Pick and place Line following robot report
PDF
Programmable logic controller - Siemens S7-1200
PPT
Sensors & Actuators
PPTX
Actuators
DOCX
pick-and-place-robot
PDF
introduction to mechatronics
PPT
Sensors and actuators
PPT
Actuators.ppt
PPT
Controller ppt
PPTX
Industrial robotics pick & place
PPTX
Wireless Pick and Place Surveillance Robot
PPT
Case Studies Power Point
Week 10 part2 pe 6282
Programming logic controllers (plc) seminar
Lecture 07 mechatronic design concepts
Design+of+mechatronics+system+&+control+of+sb w+system
Programmable Logic Controller and ladder logic programming
218001 control system technology lecture 1
Case studies powerpoint
Pick and place Line following robot report
Programmable logic controller - Siemens S7-1200
Sensors & Actuators
Actuators
pick-and-place-robot
introduction to mechatronics
Sensors and actuators
Actuators.ppt
Controller ppt
Industrial robotics pick & place
Wireless Pick and Place Surveillance Robot
Case Studies Power Point
Ad

Similar to Effective Test Suites for ! Mixed Discrete-Continuous Stateflow Controllers (20)

PPTX
Test pattern Generation for 4:1 MUX
PPT
L1_Introduction.ppt
PPT
11 whiteboxtesting
PPT
Dealing with the Three Horrible Problems in Verification
 
PPTX
Design for testability for Beginners PPT for FDP.pptx
PDF
Automated and Scalable Solutions for Software Testing: The Essential Role of ...
PDF
ATE-info
PPT
Unit 2 Unit level testing.ppt
PPTX
Design for testability and automatic test pattern generation
PPT
Software Engineering (Testing techniques)
PPT
Software Engineering (Testing techniques)
PPT
9-High-Level-Fault-Grading.ppt
PDF
Automated Testing of Hybrid Simulink/Stateflow Controllers
PPTX
Testability: Factors and Strategy
PPTX
module5 notes on random zation techniques.pptx
PPT
Chapter 14 software testing techniques
PPTX
Empirically Detecting False Test Alarms Using Association Rules @ ICSE 2015
PDF
6TL NIdays 2010
DOCX
Se unit 4
PPT
New software testing-techniques
Test pattern Generation for 4:1 MUX
L1_Introduction.ppt
11 whiteboxtesting
Dealing with the Three Horrible Problems in Verification
 
Design for testability for Beginners PPT for FDP.pptx
Automated and Scalable Solutions for Software Testing: The Essential Role of ...
ATE-info
Unit 2 Unit level testing.ppt
Design for testability and automatic test pattern generation
Software Engineering (Testing techniques)
Software Engineering (Testing techniques)
9-High-Level-Fault-Grading.ppt
Automated Testing of Hybrid Simulink/Stateflow Controllers
Testability: Factors and Strategy
module5 notes on random zation techniques.pptx
Chapter 14 software testing techniques
Empirically Detecting False Test Alarms Using Association Rules @ ICSE 2015
6TL NIdays 2010
Se unit 4
New software testing-techniques

More from Lionel Briand (20)

PDF
LTM: Scalable and Black-box Similarity-based Test Suite Minimization based on...
PDF
TEASMA: A Practical Methodology for Test Adequacy Assessment of Deep Neural N...
PDF
Automated Test Case Repair Using Language Models
PDF
Automated Testing and Safety Analysis of Deep Neural Networks
PDF
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
PDF
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
PDF
Precise and Complete Requirements? An Elusive Goal
PDF
Large Language Models for Test Case Evolution and Repair
PDF
Metamorphic Testing for Web System Security
PDF
Simulator-based Explanation and Debugging of Hazard-triggering Events in DNN-...
PDF
Fuzzing for CPS Mutation Testing
PDF
Data-driven Mutation Analysis for Cyber-Physical Systems
PDF
Many-Objective Reinforcement Learning for Online Testing of DNN-Enabled Systems
PDF
ATM: Black-box Test Case Minimization based on Test Code Similarity and Evolu...
PDF
Black-box Safety Analysis and Retraining of DNNs based on Feature Extraction ...
PDF
PRINS: Scalable Model Inference for Component-based System Logs
PDF
Revisiting the Notion of Diversity in Software Testing
PDF
Applications of Search-based Software Testing to Trustworthy Artificial Intel...
PDF
Autonomous Systems: How to Address the Dilemma between Autonomy and Safety
PDF
Mathematicians, Social Scientists, or Engineers? The Split Minds of Software ...
LTM: Scalable and Black-box Similarity-based Test Suite Minimization based on...
TEASMA: A Practical Methodology for Test Adequacy Assessment of Deep Neural N...
Automated Test Case Repair Using Language Models
Automated Testing and Safety Analysis of Deep Neural Networks
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Precise and Complete Requirements? An Elusive Goal
Large Language Models for Test Case Evolution and Repair
Metamorphic Testing for Web System Security
Simulator-based Explanation and Debugging of Hazard-triggering Events in DNN-...
Fuzzing for CPS Mutation Testing
Data-driven Mutation Analysis for Cyber-Physical Systems
Many-Objective Reinforcement Learning for Online Testing of DNN-Enabled Systems
ATM: Black-box Test Case Minimization based on Test Code Similarity and Evolu...
Black-box Safety Analysis and Retraining of DNNs based on Feature Extraction ...
PRINS: Scalable Model Inference for Component-based System Logs
Revisiting the Notion of Diversity in Software Testing
Applications of Search-based Software Testing to Trustworthy Artificial Intel...
Autonomous Systems: How to Address the Dilemma between Autonomy and Safety
Mathematicians, Social Scientists, or Engineers? The Split Minds of Software ...

Recently uploaded (20)

PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPT
Introduction Database Management System for Course Database
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Nekopoi APK 2025 free lastest update
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
history of c programming in notes for students .pptx
Design an Analysis of Algorithms I-SECS-1021-03
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
Introduction Database Management System for Course Database
Internet Downloader Manager (IDM) Crack 6.42 Build 41
How to Choose the Right IT Partner for Your Business in Malaysia
Odoo Companies in India – Driving Business Transformation.pdf
Transform Your Business with a Software ERP System
Understanding Forklifts - TECH EHS Solution
Nekopoi APK 2025 free lastest update
How to Migrate SBCGlobal Email to Yahoo Easily
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Wondershare Filmora 15 Crack With Activation Key [2025
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
ManageIQ - Sprint 268 Review - Slide Deck
PTS Company Brochure 2025 (1).pdf.......
history of c programming in notes for students .pptx

Effective Test Suites for ! Mixed Discrete-Continuous Stateflow Controllers

  • 1. .lusoftware veriïŹcation & validation VVS Effective Test Suites for ! Mixed Discrete-Continuous StateïŹ‚ow Controllers Reza Matinnejad Shiva Nejati Lionel Briand SnT Center, University of Luxembourg Thomas Bruckmann Delphi Automotive Systems, Luxembourg
  • 2. Cyber Physical Systems (CPSs) Combination of computations (algorithms) and physical dynamics (differential equations) 2 Physical world Computation
  • 3. Testing (Typical) Software 3 X = 10, Y = 30 Z = 20 Algorithms Fail Pass Z = 10
  • 4. Testing (CPS) Software 4 Algorithms + Differential Equations Fail Z = 20 X = 10, Y = 30 S1(t) S2(t) S3(t) Pass Z = 20 S3(t) S1 t S2 t S3 t S3 t
  • 5. Software Testing Challenges (CPS) ‱ Mixed discrete-continuous behavior (combination of algorithms and continuous dynamics) ‱ Inputs/outputs are signals (functions over time) ‱ Simulation is inexpensive but not yet systematically automated ‱ Partial test oracles 5
  • 6. Generating effective test suites for Software used in ! Cyber-Physical Systems 6 Our Goal
  • 7. Simulink/StateïŹ‚ow ‱ A data ïŹ‚ow-driven block diagram language ‱ Is widely used to develop Cyber Physical Systems ‱ Is executable 7
  • 8. StateïŹ‚ow ‱ A Statechart dialect integrated into Simulink ‱ Captures the state-based behavior of CPS software ‱ Has mixed discrete-continuous behavior 8
  • 9. Generating effective test suites for mixed discrete-continuous StateïŹ‚ow controllers 9 Our Goal
  • 10. Discrete Behavior What we typically think of software models 10 On Off On Off Speed < 10 Speed > 10
  • 11. Discrete-Continuous Behavior What software models are actually being built using StateïŹ‚ow 11 On Off CtrlSig On Off Speed < 10 Speed > 10 t CtrlSig t CtrlSig
  • 12. Generating effective test suites for mixed discrete-continuous StateïŹ‚ow controllers 12 Our Goal
  • 13. Test Suite Effectiveness (1) ‱  Test suite size should be small because ‱  Test oracles cannot be fully automated ‱  Output signals need to be inspected by engineers 13 Model Simulation Input Signals Output Signal(s) S3 t S2 t S1 t S3 t S2 t S1 t Test Case 1 Test Case 2
  • 14. Test Suite Effectiveness (2) ‱  Test suites should have a high fault revealing power ‱  Small deviations in outputs may not be recognized/important ‱  Test inputs that drastically impact the output signal shape are likely to have a higher fault revealing power 14 Test Output 1 TimeTime CtrlSig Faulty Model Output Correct Model Output Test Output 2
  • 16. Test Generation Algorithms ‱  Input-based Test Generation: ‱  Input Diversity Algorithm ‱  Coverage-based Test Generation: ‱  State Coverage Algorithm ‱  Transition Coverage Algorithm ‱  Output-based Test Generation: ‱  Output Diversity Algorithm ‱  Failure-based Algorithm 16
  • 17. Input Diversity ‱ Maximizing distances among input signals 17 Test Case 1 Test Case 2 Input Signal 1 Input Signal 2 S1 t S1 t S2 t S2 t
  • 19. Test Generation Algorithms ‱  Input-based Test Generation: ‱  Input Diversity Algorithm ‱  Coverage-based Test Generation: ‱  State Coverage Algorithm ‱  Transition Coverage Algorithm ‱  Output-based Test Generation: ‱  Output Diversity Algorithm ‱  Failure-based Algorithm 19
  • 20. Structural Coverage ‱ Maximizing the number of states/transitions covered 20 State Coverage Transition Coverage 1 4 2 3 1 4 2 3
  • 21. Test Generation Algorithms ‱  Input-based Test Generation: ‱  Input Diversity Algorithm ‱  Coverage-based Test Generation: ‱  State Coverage Algorithm ‱  Transition Coverage Algorithm ‱  Output-based Test Generation: ‱  Output Diversity Algorithm ‱  Failure-based Algorithm 21
  • 22. Output Diversity ‱ Maximizing distances among output signals 22 Test Case 1 Test Case 2 Output Signal S3 t S3 t
  • 23. Failure-based Test Generation 23 Instability Discontinuity 0.0 1.0 2.0 -1.0 -0.5 0.0 0.5 1.0 Time CtrlSigOutput ‱ Maximizing the likelihood of presence of speciïŹc failure patterns in output signals 0.0 1.0 2.0 Time 0.0 0.25 0.50 0.75 1.0 CtrlSigOutput
  • 24. We developed our failure-based test generation algorithm using! Meta-Heuristic Search 24
  • 25. The Alternative Choice 25 Our ApproachExisting WorkTechnique Model Checking - Require precisely deïŹned oracles (user-speciïŹed assertions) - Have been largely applied to time-discrete models - State-explosion problem! - No need for automated test oracles - Applicable to time-continuous and non-linear models - Our algorithms are black-box randomized search: - non-memory intensive - can be parallelized
  • 26. 26 Failure-based Test Generation using Meta-Heuristic Search Input Signals Slightly Modifying Each Input Signal Fitness Functions Capturing the Likelihood of Presence of Failure Patterns in the Output Signals Repeat Until maximum resources spent S Initial Candidate Solution Search Procedure R Tweak (S) if Fitness (R) > Fitness (S) S R Return S
  • 27. Output Stability ! Fitness Function ‱ Sum of the differences of signal values for consecutive simulation steps 27 stability(sgo) = kP i=1 |sgo(i · t) sgo((i 1) · t)| 0.0 1.0 2.0 -1.0 -0.5 0.0 0.5 1.0 Time CtrlSigOutput
  • 28. Output Continuity ! Fitness Function 28 ‱ Maximum of the minimum left or right derivatives for all the simulation steps 0.0 1.0 2.0 Time 0.0 0.25 0.50 0.75 1.0 CtrlSigOutput continuity(sgo) = K 1 max i=1 (min(|LeftDer(sgo, i)|, |RightDer(sgo, i)|))
  • 29. Comparing the! Test Generation Algorithms! ! 29 Evaluation
  • 30. Research Questions ‱  RQ1 (Fault Revealing Ability) ‱  RQ2 (Fault Revealing Subsumption) ‱  RQ3 (Test Suite Size) 30
  • 31. Experiment Setup ‱ Three StateïŹ‚ow models: two industrial and one publicly available case study 31 75 (faulty models) * 100 (algorithm runs) *6 (generation algorithms) * 5 (different test suite sizes) = 225,000 test suites (in total) Test Suite (size=3,5, 10,25,50) { 1.Fault Seeding 2.Generation Algorithm SF Faulty SF {75 75
  • 32. Research Question 1! Fault Revealing Ability How does the fault revealing ability of our proposed test generation algorithms compare with one another? 32
  • 33. 1.0 0.0 0.5 Input Diversity Output Diversity Fault Revealing Rate RQ1: Fault Revealing Ability 33 1.  Output-based and coverage-based algorithms outperformed the input diversity algorithm 2.  Output-based algorithms outperformed the coverage-based algorithms 3.  Overall, output stability algorithm performed the best
  • 34. Research Question 2! Fault Revealing Subsumption Is any of our generation algorithms subsumed by other algorithms? 34
  • 35. RQ2: Fault Revealing Subsumption 35 ‱  For each of the 75 faulty models, we identiïŹed the best generation algorithm(s) for different test suite sizes (5, 10, 25, and 50) Fault 1 State Coverage Transition Coverage Output Diversity Output Stability Output Continuity Fault 2 Fault 3 Fault 4
  • 36. RQ2: Fault Revealing Subsumption (2) 36 1.  The coverage-based algorithms found the least number of faults 2.  Coverage-based algorithms are subsumed by output diversity algorithm when the test suite size increases (size = 25 , 50)
  • 37. Research Question 3! Test Suite Size What is the impact of the size of test suites generated by our generation algorithms on their fault revealing ability? 37
  • 38. RQ3: Test Suite Size 38 1.  The fault revealing rates for output stability/continuity is very high for small test suites(size = 3,5) for Instability/Discontinuity failures 2.  For Other failures, the ability of output diversity in revealing failures rapidly increases as the test suite size increases DiscontinuityInstability Others 0.0 0.5 1.0 3 5 10 25 50 Test Suite Size FaultRevealingRateMean 3 5 10 25 50 3 5 10 25 50 Output Stability Ouput Continuity State Coverage Transition CoverageOutput Diversity
  • 40. Lesson 1! Coverage-based algorithms are less effective than output-based algorithms ‱  The test cases resulting from state/transition coverage algorithms cover the faulty parts of the models ‱  97% state coverage and 81% transition coverage ‱  Cover faulty parts for 73 (out of 75) fault-seeded models ‱ However, they fail to generate output signals that are sufïŹciently distinct from the oracle signal, hence yielding a low fault revealing rate 40
  • 41. Lesson 2! Combining Output-based Algorithms 41 ‱  We suggest to divide the test suite size budget between output-based algorithms: Output Continuity Output Stability Output Diversity
  • 43. .lusoftware veriïŹcation & validation VVS Effective Test Suites for ! Mixed Discrete-Continuous StateïŹ‚ow Controllers Reza Matinnejad (reza.matinnejad@uni.lu) Shiva Nejati Lionel Briand SnT Center, University of Luxembourg Thomas Bruckmann Delphi Automotive Systems, Luxembourg
  • 44. Lesson 1! Combing Output-based Algorithms ‱  We suggest to divide the test suite size budget between output stability, output continuity, and output diversity: 1.  Allocate a small part of the test budget to output continuity 2.  Share the rest of the budget between output stability and output diversity, by giving output diversity a higher share 44
  • 45. Input / Output Vectors 45 0 5 10 50 150 250 FuelLevelSensor FuelLevel 0 5 10 100.0 91.43 84.43 75.62 70.01 66.19 61.21 56.66 54.32 52.81 50 100 Time (s) Time (s)
  • 46. Study subjects 46 Publicly Available Name No. of Inputs Hierarchical States Parallelism No. of States SCPC ASS No No 23 42 13 16 2 No 1 No GCS Yes 8 10 0 Yes No. of Transitions 25 53 27 ‱ SCPC: Supercharger Clutch Position Controller ‱ ASS: Auto Start Stop Control ‱ GCS: Guidance Control System
  • 47. Fault Revealing Rate (FRR) 47 FRR(SF, TS) = ( 1 91ïŁżiïŁżq ˆdist(sgi, gi) > THR 0 81ïŁżiïŁżq ˆdist(sgi, gi) <= THR ‱  FRR based on gi, output of the fault-free model, sgi, output of the fault- seeded model, and a threshold THR: 1.  For continuous dynamic systems, the system output is acceptable when the deviation is small and not necessarily zero 2.  It is more likely that manual testers recognize a faulty output signal when the signal shape drastically differs from the oracle.
  • 48. RQ3: Test Suite Size 48 1.  The fault revealing rates for output stability/continuity is very high for small test suites for Instability/Discontinuity 2.  For “Other” failures, the ability of OD in revealing failures rapidly increases as the test suite size increases Discontinuity SC TC OD OS OC * * + + -- Instability Others 0.0 0.5 1.0 3 5 10 25 50 * * * * + + + - - Test Suite Size FRRMean + - - 3 5 10 25 50 3 5 10 25 50 * * * - - - + + + - - - * * * + + + + + * * *- - -