Model-Based Testing dans l'industrie Usages et dissémination Bruno Legeard Séminaire Test & Méthodes formelles LAAS-CNRS Toulouse 16 juin 2015
400 000 Testeurs certifiés 2
Les multiples facettes du MBT Tests 3
Les multiples facettes du MBT Model-Based Testing : «Testing based on or involving models.» ISTQB Glossary - 2015 4
Sommaire 1. Introduction au MBT a. Motivations et usage b. Processus et roles 2. Taxonomie des approches MBT 3. Domaines d application 4. Conclusion 5
Motivations Source: MBT User Survey 2014 Source : Model-Based Testing, Where do we stand? CACM 2/15, Binder, Legeard, Kramer 6
Motivations Test Models provide us more flexibility in the creation of automated test scripts by using different test case generation strategies according to the current needs (different robustness test, tests for changed or critical requirements, etc.) Executable model paradigm should enable us to create self-testing mechanisms. MBT helps us to improve change request process MBT supports test automation MBT is capable to also validate the test basis Massive increase of reuse Improved coverage of requirement readability of coverage Increased productivity and improved product reliability (new type of bugs, Increased test coverage) 7
Niveaux de test Source: MBT User Survey 2014 8
Types de test Source: MBT User Survey 2014 9
Pratique de la modélisation Do you use models in other development phases, for example for requirement elicitation or system design? 41,1% 58,9% Yes No Source: MBT User Survey 2014 10
Pratique de la modélisation What type of models do you use in those other development phases? 80,0% 70,0% 60,0% 50,0% 40,0% 30,0% 20,0% 10,0% 0,0% Use Case diagrams Activity diagrams State machines Sequence charts Business Process models Domain Specific Language models Source: MBT User Survey 2014 11
Sommaire 1. Introduction au MBT a. Motivations et usage b. Processus et roles 2. Taxonomie des approches MBT 3. Domaines d application 4. Conclusion 12
Processus MBT - 1 Source : Mark Utting, Alexander Pretschner, and Bruno Legeard. 2012. A taxonomy of model-based testing approaches. Softw. Test. Verif. Reliab. 22, 5 (August 2012), 297-312. 13
Processus MBT - 2 14
Processus MBT 15
Rôles du MBT 16
Modélisation MBT La modélisation MBT dépend des objectifs de test : Modèle abstrait Le modèle couvre les comportements à tester Modèle détaillé et précis Le modèle doit permettre de calculer les cas de test et les résultats attendus établir automatiquement le verdict de test Modèle validé et vérifié Si le verdict de test «Fail» : l erreur est-elle dans l implantation ou dans le modèle? Le test à partir de modèle confronte deux points de vue 17
Sommaire 1. Introduction au MBT a. Motivations et usage b. Processus et roles 2. Taxonomie des approches MBT 3. Domaines d applications 4. Conclusion 18
Taxonomie des approches Source : Mark Utting, Alexander Pretschner, and Bruno Legeard. 2012. A taxonomy of model-based testing approaches. Softw. Test. Verif. Reliab. 22, 5 (August 2012), 297-312. 19
Sujet et focus Modèle MBT Sujet Modèle du système Modèle de l environnement Modèle des tests Focus Structure Comportement Modèle MBT intègre généralement ces différents aspects 20
Modélisation MBT - Exemple 21
Modélisation MBT - Exemple 22
Sujet du modèle Source : Mark Utting, Alexander Pretschner, and Bruno Legeard. 2012. A taxonomy of model-based testing approaches. Softw. Test. Verif. Reliab. 22, 5 (August 2012), 297-312. 23
Sujet du modèle MBT What is the subject of your model? 50 45 40 35 30 25 20 15 10 5 0 The model describes how the system works. The model describes the system's environment, concentrating on interfaces and stimuli (e.g. from a user's point of view). The model describes the test procedure rather than the system itself. The one and only subject of the model Important subject of the model Not the major subject of the model Not at all a subject of the model Source: MBT User Survey 2014 24
Focus du modèle MBT What aspect does your MBT model focus on? 6% 35% 59% Structural aspect Behavioral aspect Both Source: MBT User Survey 2014 25
Paradigmes de modélisation De nombreux paradigmes : Modélisation des comportements (non exhaustif) Flow Charts / BPMN / Diagrammes d activité Data Flow Diagrams Diagramme Etat / Transitions Machine à états finis Pre-post conditions / OCL Chaine de markov Event Sequence Graph Modélisation des points de contrôles et d observation Diagramme de classe (UML) Diagrammes de blocks Représentation : Graphique (plus «intuitive» ) Textuelle (plus précise) 26
Modèle MBT - Workflow 27
Modèle MBT Langage d action 28
Event Sequence Graph 29
Utilisation de modèles existants Peut-on utiliser des modèles d analyse, de conception ou de développement pour le test? Oui, mais: Est-ce bien le bon niveau d abstraction? Est-ce en phase avec mes objectifs de test? Est-ce que ma technologie de génération de tests peut le traiter? 30
Réutilisation If you use models both for analysis or design and for testing activities, how different are these models? 35,0% 30,0% 25,0% 20,0% 15,0% 10,0% 5,0% 0,0% Completely identical Slightly modified Largely modified Completely different Source: MBT User Survey 2014 31
Exemple de reprise de modèle Processus métier Analyste fonctionnel Business scenario Analyste de test 32
Taxonomie MBT 33
Génération du référentiel de tests Modélisation pour la génération de tests Exigences Métier Référentiels Tests Fonctionnels de tests Tests prêts à être exécutés auto Et, ou manuel 34
Que génère t on? What artifacts do you generate from the model? 90,0% 80,0% 70,0% 60,0% 50,0% 40,0% 30,0% 20,0% 10,0% 0,0% Test cases (for manual test execution) Test scripts (for automated test execution) Test data Other artifacts (documentation, test suites,...) Source: MBT User Survey 2014 35
Matrice de traceabilité 36
Critères de sélection de tests 37
Critères de sélection de test Source : ISTQB Certification Model-Based Testing 38
Requirements coverage Structural model coverage i) Data coverage ii) Random & stochastic Scenario- / pattern-based iii) Project-driven iv) Critère de sélection de tests What selection criteria do you apply to limit the number of generated tests? 80,0% 70,0% 60,0% 50,0% 40,0% 30,0% 20,0% 10,0% 0,0% Source: MBT User Survey 2014 39
Suivi de la couverture 70,0% 60,0% 50,0% 40,0% 30,0% 20,0% 10,0% 0,0% What kind of coverage is measured for your test runs? Source: MBT User Survey 2014 40
Taxonomie MBT 41
Exécution des tests MBT Exécution manuelle Génération de scripts et exécution avec un harnais de test automatisé Exécution à-la-volée Offline MBT Model-based testing approach whereby test cases are generated into a repository for future execution. Online MBT Model-based testing approach whereby test cases are generated and executed simultaneously. ISTQB Glossary - 2015 42
Exécution des tests MBT How are the tests executed? 80,0% 70,0% 60,0% 50,0% 40,0% 30,0% 20,0% 10,0% 0,0% manually automatically off-line (first generated, then executed) automatically on-the-fly (generated and executed in one step) Source: MBT User Survey 2014 43
Sommaire 1. Introduction au MBT a. Motivations et usage b. Processus et roles 2. Taxonomie des approches MBT 3. Domaines d applications 4. Conclusion 44
Domaines d application Web application; 18,6% What is the general application domain of the system under test? Communications; 4,3% Gaming; 2,9% Enterprise IT (including packaged applications); 30,0% Software Infrastructure; 5,7% Embedded software (not real-time); 11,4% Embedded controller (real-time); 27,1% 45
Niveau de satisfaction Overall, how effective do you think MBT has been? extremely effective moderately effective slightly effective no effect slightly uneffective moderately uneffective extremely uneffective 0,0% 10,0% 20,0% 30,0% 40,0% 50,0% Source: MBT User Survey 2014 46
Sommaire 1. Introduction au MBT a. Motivations et usage b. Processus et roles 2. Taxonomie des approches MBT 3. Domaines d applications 4. Conclusion 47
MBT? En émergence Re Research PD Pre Development SD Serie Development TE - TEsting related department Source : Harald Altinger, Franz Wotawa, and Markus Schurius. 2014. Testing methods used in the automotive industry: results from a survey. In Proceedings of the 2014 Workshop on Joining AcadeMiA and Industry Contributions to Test Automation and Model-Based Testing (JAMAICA 2014). ACM, New York, NY, USA, 1-6. 48
UCAAT 2015 49
Thanks for your attention Source - http://model-based-testing.info 50