model-based testing from uml modelsuml model - class diagram - object diagram - state machines - ocl...
TRANSCRIPT
![Page 1: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/1.jpg)
Model-Based Testing From UML Models
Bruno Legeard,Leirios,France,W6
![Page 2: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/2.jpg)
Model-Based Testing from UML models
Manchester – Thursday, 6th December 2006
Bruno Legeard – LEIRIOS Technologies
![Page 3: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/3.jpg)
Outline
1. The challenge of functional validation2. Model-Based Testing (MBT) process3. Main activities of MBT with UML4. A case study: eTheater web application5. Benefits of MBT with UML
![Page 4: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/4.jpg)
A solution to automate functional test design
• Does my application respect the requirements?
Model-based testing
![Page 5: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/5.jpg)
To specify the most relevant tests
To keep the skyrocketing number of combinations under control
To optimize the functional coverage
T o lim it the tester’s subjectivity
To efficiently manage the functional changes
Automate test design withModel-Based Testing
HOW :
Functional ValidationA real challenge
![Page 6: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/6.jpg)
Model-based testing process
Use case model
Analysis model
<<realize>>
Design model
<<refine>>
Implementation model
<<implement>>
Test Model
<<refine>>
Executable scripts
<<implement>>
Adaptation layer
<<use>>
<<use>>Validation
Tests generation
Development Process
Validation Process
![Page 7: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/7.jpg)
Business Analyst
Test Manager
QA Tester
Analyst
QA Tester
Test Manager QA Tester
Requirements
LEIRIOS Test
Generator
Test Scripts UML Model
Modeling Tools
Test Management & Execution Tools
AUTOMATED TEST DESIGN
Model-Based Testing Process
![Page 8: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/8.jpg)
LEIRIOS Test Generator™
Requirements
LEIRIOS TestG enerator™
Modeling Tools
Test Management and execution tools
Automate the validationtesting process
MBT Tools
![Page 9: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/9.jpg)
Main activities of MBT with UML
1. Refine (or develop) the functional model for test generation
2. Configure automated test generation
3. Adapt generated test cases in executable test scripts
![Page 10: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/10.jpg)
LTG supports a sub-part of UML2.0 for automated test generation purpose:
• Class diagrams – static data and operation definition• State Machines with OCL – Dynamic behavior• Object diagrams – Initial state
The test model is developed by refinement of the functional model:- precise enough- at the good level of abstraction depending of the test objectives
Modeling for testing
![Page 11: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/11.jpg)
1. The validation engineer defines test campaigns:– test objectives (what should be tested?)– coverage criteria (how thoroughly should it be tested?)
Requirements
UnreachableUnreachedReached
Campaign coverage
3. LTG computes the test cases for each target and display the resulting coverage:– target coverage– requirements coverage
2. LTG computes precise targets for which tests have to be generated: T1 T2 T3 T4 T5
Coverage and risk analysis
Coverage reports
Test targetsSmart Testing™
Automated test generation from the model
![Page 12: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/12.jpg)
Test Selection Criteria
• 3 families of model coverage criteria– Transition coverage (All-Transitions)– Decision coverage (Condition/Decision
coverage)– Data coverage (One_Value, All_Values,
Boundary Values)
![Page 13: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/13.jpg)
Test cases
LTG Adapter
public class TestScript{// ${test.getName()}public void ${test.name}(){// preamble${preamble.getMessages()}
// body${body.getMessages()}
// observation${observation.getMessages()}}
Test script patternsTree structure patterns
Main features:•Test cases are UML Testing Profile compliant•Tree structure and patterns are very flexible• S im ple/com plex m appings, options,…
- Java/ JUnit- Mercury TD / QTP- Compuware QARun- … any language
Executabletest scripts
Generate executable scripts
![Page 14: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/14.jpg)
LTG -Test generation process
Requirements
UML Model- Class diagram- Object diagram- State Machines- OCL
1) Model
LTG Adapter
ExecutableTest Scripts
4) Export
LTGModel Animator
2) Check
LTGTests Generator
3) Generate
Test Targetsand Test Cases
Test Ex. Env. + Adaptation layerTest
results
5) Execute and analyse
![Page 15: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/15.jpg)
Case study – eTheater application
A web-based system for buying movie tickets
1. Modeling in UML2. Test generation with LEIRIOS Test Generator3. Adapt generated test cases in executable test
scripts
![Page 16: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/16.jpg)
eTheater – Use cases
The e-Theater application allows movie-goers to buy movie tickets online, before they go to the theater.
![Page 17: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/17.jpg)
Use cases – Buy Tickets
![Page 18: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/18.jpg)
Use cases – Buy Tickets (2)
![Page 19: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/19.jpg)
eTheater Model – Class diagram
Class diagrams give static data and operation signatures
![Page 20: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/20.jpg)
eTheater Model – Object diagram
Object diagram defines the initial state for test generation
![Page 21: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/21.jpg)
eTheater Model – State machine
State machine and OCL definitions define the expected behavior
![Page 22: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/22.jpg)
Configure test generation
• Model coverage criteria– Transition coverage (all transitions are
activated)– Condition/Decision coverage (each condition in
each decision)– One value per equivalence class, but All values
for Card type (Visa, Mastercard, Amex)
22 test cases have been generated
![Page 23: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/23.jpg)
Test generation results
![Page 24: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/24.jpg)
eTheater Model – State machine
![Page 25: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/25.jpg)
Test adaptation
Three classical approaches to test case adaptation into executable test scripts
![Page 26: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/26.jpg)
ETheater –Executable scripts
generation
• Use the mixed approach• Generate Ruby scripts• Adaptation layer to execute operation calls
![Page 27: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/27.jpg)
• Return on Investment– Generate tests and scripts from the model– Reuse existing modeling artifacts from requirements analysis
• Improved test quality– Automated generation from the model using coverage criteria gives
a strong rationale for you test• Tester keep the control
– The tester drive the test generation using model coverage criteria• Much easier test maintenance
– Evolving requirements: update the model and re-generate• Generate test earlier
– Generating test from analysis model contributes to reinforce product requirements
Benefits of MBT with UML
![Page 28: Model-Based Testing From UML ModelsUML Model - Class diagram - Object diagram - State Machines - OCL 1) Model LTG Adapter Executable Test Scripts 4) Export LTG Model Animator 2) Check](https://reader030.vdocument.in/reader030/viewer/2022040304/5e9750b257111d03664549bb/html5/thumbnails/28.jpg)