Slide 1

Slide 1 text

Automated Test Generation for production systems with a Model-based Testing approach William Durand • PhD Thesis Defense • May 4th, 2016

Slide 2

Slide 2 text

1 2 "Automated..." What? Automated: “to use machines instead of people” Test: “the means by which the quality of anything is determined” Generation: “the act or process of generating” (for) production systems: “a set of production machines controlled by a software (or application)” (with a) Model-based Testing approach

Slide 3

Slide 3 text

3 Outline 1. Introduction 2. Model inference 3. Testing 4. Conclusion

Slide 4

Slide 4 text

4 . 1 1. Introduction 2. Model inference 3. Testing 4. Conclusion

Slide 5

Slide 5 text

4 . 2 Very First Meeting @ Michelin “We face several issues with our Level 2 applications.” “Some of them are not covered by tests. We have many legacy applications and we would like to avoid regressions.” “We have outdated documentation we cannot rely on.” “These applications run in our factories for years, but we can state that they behave correctly in production.”

Slide 6

Slide 6 text

4 . 3 Computer-Integrated Manufacturing (CIM)

Slide 7

Slide 7 text

Production System This slide contained a confidential figure, and I could not publish it :-(

Slide 8

Slide 8 text

4 . 4 4 . 5 Development Teams 50+ applications running in production Different programming languages and versions MUST be maintained for ~20 years!

Slide 9

Slide 9 text

4 . 6 Factories Stability over anything else Maintenance periods are planned, but rather long (> 1 week) 1h (unexpected) downtime = 50k $

Slide 10

Slide 10 text

4 . 7 This Thesis The goal of this thesis is to propose technical solutions to Michelin engineers in order to prevent unexpected downtimes with (regression) testing.

Slide 11

Slide 11 text

4 . 8 Hypotheses 1. The applications deployed in production behave correctly 2. We do not consider any (existing) documentation

Slide 12

Slide 12 text

4 . 9 Insight of the Approach 1. The inference of models of production systems based on the data exchanged in a production environment 2. The design of a conformance testing technique based on these inferred models, targeting production systems

Slide 13

Slide 13 text

4 . 10 Publications Durand, W., & Salva, S. (2014). Inférence de modeles dirigée par la logique métier. In Actes de la 13eme édition d’AFADL, atelier francophone sur les Approches Formelles dans l’Assistance au Développement de Logiciels. Durand, W., & Salva, S. (2014). Inferring models with rule-based expert systems. In Proceedings of the Fifth Symposium on Information and Communication Technology (pp. 92-101). ACM. Salva, S., & Durand, W. (2015). Autofunk, a fast and scalable framework for building formal models from production systems. In Proceedings of the 9th ACM International Conference on Distributed Event-Based Systems (pp. 193-204). ACM. Durand, W., & Salva, S. (2015). Autofunk: An Inference-Based Formal Model Generation Framework for Production Systems. In FM 2015: Formal Methods (pp. 577-580). Springer International Publishing. Durand, W., & Salva, S. (2015). Passive testing of production systems based on model inference. In Formal Methods and Models for Codesign (MEMOCODE), 2015 ACM/IEEE International Conference on (pp. 138-147). IEEE. 2 under submissions (ACM CSUR, JSS)

Slide 14

Slide 14 text

5 . 1 1. Introduction 2. Model Inference of Production Systems 3. Testing 4. Conclusion

Slide 15

Slide 15 text

5 . 2 Symbolic Transition System (STS)

Slide 16

Slide 16 text

5 . 3 Known Issues Difficult Time-consuming Must be kept up-to-date

Slide 17

Slide 17 text

5 . 4 Model Inference A research field that aims at automatically deriving models, expressing behaviors of existing software.

Slide 18

Slide 18 text

5 . 5 Active vs. Passive Active inference: methods that interact with the system Passive inference: use a fixed set of data (no interaction) † We should not disturb the production systems.

Slide 19

Slide 19 text

5 . 6 Passive Inference Documentation White-box State-based abstraction Event sequence abstraction?? (e.g., kTail, kBehavior) † Over-approximated models are not suitable for testing.

Slide 20

Slide 20 text

5 . 7 Production Event & Michelin Systems Software exchange information with physical devices and machines by sending and receiving production events Michelin's exchanging systems guarantee the order in which the production events occured Events can be captured directly into these systems to avoid loss, reordering, and/or duplication of the events

Slide 21

Slide 21 text

5 . 8 Example 17-Jun-2014 23:29:59.00|INFO|New File 17-Jun-2014 23:29:59.50|17011|MSG_IN [nsys: 1] \ [nsec: 8] [point: 1] [pid: 1] 17-Jun-2014 23:29:59.61|17021|MSG_OUT [nsys: 1] \ [nsec: 8] [point: 3] [tpoint: 8] [pid: 1] 17-Jun-2014 23:29:59.70|17011|MSG_IN [nsys: 1] \ [nsec: 8] [point: 2] [pid: 2] 17-Jun-2014 23:29:59.92|17021|MSG_OUT [nsys: 1] \ [nsec: 8] [point: 4] [tpoint: 9] [pid: 2] A set of production events in a human readable format.

Slide 22

Slide 22 text

5 . 9 Interesting Facts Each production event is tied to a product (e.g., a tire), identified by a product identifier ( ). Gathering all production events related to a product allows to retrieve what happened to it (behaviors). q That is what Michelin experts use to do.

Slide 23

Slide 23 text

5 . 10 The Big Picture

Slide 24

Slide 24 text

5 . 11 Expert System A computer system that emulates the decision-making ability of a human expert. Inference engine Facts Inference rules “When LHS, then RHS”

Slide 25

Slide 25 text

5 . 12 Autofunk A framework and a tool to infer models v1: proof of concept for web applications v2 and v3: target production systems

Slide 26

Slide 26 text

5 . 13

Slide 27

Slide 27 text

5 . 14 Collecting Traces Production event: "Noise" filtering with inference rules Trace set

Slide 28

Slide 28 text

5 . 15 Example (1/2) 17-Jun-2014 23:29:59.00|INFO|New File rule "Remove INFO events" when: $valued_event: ValuedEvent(Assign.type == TYPE_INFO) then retract($valued_event) end A rule written with Drools. y The event will be filtered out.

Slide 29

Slide 29 text

5 . 16 Example (2/2) Traces(Sua) = { (17011({ nsys, nsec, point, pid }), { nsys:=1, nsec:=8, point:=1, pid:=1 }) (17021({ nsys, nsec, point, tpoint, pid }), { nsys:=1, nsec:=8, point:=3, \ tpoint:=8, pid:=1 }) , (17011({ nsys, nsec, point, pid }), { nsys:=1,nsec:=8, point:=2, pid:=2 }) (17021({ nsys, nsec, point, tpoint, pid }), { nsys:=1, nsec:=8, point:=4, \ tpoint:=9, pid:=2 }) } (17011({ nsys, nsec, point, pid }), { nsys:=1, nsec:=8, point:=1, pid:=1 }) ↑ ↑ ↑

Slide 30

Slide 30 text

5 . 17

Slide 31

Slide 31 text

5 . 18 Segmentation & Filtering Autofunk v2: statistical analysis Autofunk v3: k-means clustering algorithm Complete trace set

Slide 32

Slide 32 text

5 . 19 Representation of a Workshop

Slide 33

Slide 33 text

5 . 20

Slide 34

Slide 34 text

5 . 21 Model Generation Based on the STS/LTS model definitions A run set is constructed from : Each run is transformed into a unique STS path:

Slide 35

Slide 35 text

5 . 22 Example

Slide 36

Slide 36 text

5 . 23 Inferred Models One (sub-)model per entry point Common location per model Large yet partial STS models

Slide 37

Slide 37 text

5 . 24

Slide 38

Slide 38 text

5 . 25 Model Reduction Paths with same sequence of events are merged Guards are stored into matrices Fast computation with hash functions Trace equivalence between and

Slide 39

Slide 39 text

5 . 26 Example

Slide 40

Slide 40 text

5 . 27 Reduced Models

Slide 41

Slide 41 text

5 . 28 Experimentation Results Exp. # events # # ... D1 3,851,264 73,364 35,541 924 D2 17,402 837 E1 7,635,494 134,908 61,795 1,441 E2 35,799 1,401 F1 9,231,160 161,035 77,058 1,587 F2 43,536 1,585 q It took 5 minutes to build the two models of experiment F.

Slide 42

Slide 42 text

6 . 1 1. Introduction 2. Model inference 3. Testing 4. Conclusion

Slide 43

Slide 43 text

6 . 2 Model-based Testing The application of Model-based design for designing and optionally also executing artifacts to perform testing.

Slide 44

Slide 44 text

6 . 3 Active vs. Passive † We should not disturb the production systems (again).

Slide 45

Slide 45 text

6 . 4 Offline Passive Testing Model inference on a System under analysis ( ) Conformance testing on a System under test ( ) Reuse the reduced models Collect traces on , then perform testing

Slide 46

Slide 46 text

6 . 5 The Big Picture

Slide 47

Slide 47 text

6 . 6 Model Normalization Remove runtime-dependent information Label verdict locations with “Some possible complete behaviors that should happen”

Slide 48

Slide 48 text

6 . 7 Example

Slide 49

Slide 49 text

6 . 8 Implementation Relation (1/2)

Slide 50

Slide 50 text

6 . 9 Implementation Relation (2/2) “Since I know that my model is not complete, I am willing to accept not standard behaviors till a certain point.”

Slide 51

Slide 51 text

6 . 10 Example

Slide 52

Slide 52 text

6 . 11 Derived Models

Slide 53

Slide 53 text

6 . 12 Passive Testing Algorithm One unique algorithm Two verdicts: ≤ ct and ≤ mct Provides possibly fail trace sets Algorithm is sound:

Slide 54

Slide 54 text

6 . 13 Use Case (1/2) : 53,996 traces : 25,047 traces y 98% are traces. The remaining 2% are new behaviors that never occured before. q It took 10 minutes to check conformance.

Slide 55

Slide 55 text

6 . 14 Use Case (2/2) 2% represents 500 traces, and can contain false positives. “Still way better than before (25,000).” Larger trace sets should help How to refine this possibly fail trace set?

Slide 56

Slide 56 text

7 . 1 1. Introduction 2. Model inference 3. Testing 4. Conclusion

Slide 57

Slide 57 text

7 . 2 Recap' Two approaches combining model inference, machine learning, and expert systems to infer models for web applications and production systems (Autofunk) Offline passive testing for production systems on-top of Autofunk, along with two implementation relations An implementation of Autofunk for Michelin

Slide 58

Slide 58 text

7 . 3 A Note on Autofunk 2831 LOC, Java 8, tested (90% code cov.) 10 inference rules for Michelin Not a production-ready tool

Slide 59

Slide 59 text

7 . 4 Future Work

Slide 60

Slide 60 text

7 . 5 Online Passive Testing Just-in-time fault detection Traces constructed on-the-fly Work in progress A few remaining issues

Slide 61

Slide 61 text

7 . 6 Active Testing? (Record-Replay)

Slide 62

Slide 62 text

7 . 7 And Beyond! Visualization (fault localization) Data mining (predictive maintenance, slowness)

Slide 63

Slide 63 text

7 . 8 “These applications run in our factories for years, but we can state that they behave correctly in production.”

Slide 64

Slide 64 text

7 . 8 7 . 9 Thoughts On Model Inference How to avoid over- or under-approximation? More techniques should take scalability into account Combining research fields = WIN!

Slide 65

Slide 65 text

8 Thank You. Questions?