Presented By :
Dilruk G.A. (148209B)
Jagoda S.D.
(148214K)
Friday, April 24, 2015 1
Model-Driven Testing with
UML 2.0
Zhen Ru Dai
Fraunhofer FOKUS, Kaiserin-Augusta-Allee 31, 10589 Berlin, Germany
dai@fokus.fraunhofer.de
Index …
 Introduction
 Approaches to Model-Driven Testing
 The UML 2.0 Testing Profile (U2TP)
 A Methodology on Model-Driven Test
Development
 Test Design Model Transformation
 Summary
Friday, April 24, 2015 2
Introduction
 The Model-Driven Architecture (MDA) is not only
about system modeling.
 The early integration of testing into the
development process becomes more and more
important.
 U2TP bridges the gap between designers and
testers by providing a means for using UML for
both system modeling and test specification.
Friday, April 24, 2015 3
Approaches to Model-Driven Testing
Friday, April 24, 2015 4
The UML 2.0 Testing Profile
(U2TP)
 The Architecture Concepts
 System Under Test (SUT) – One or More Object
 Test Components – Objects within test system
 Test Context - Message between components
 Scheduler - Control the test execution and test components
 The Behavior Concepts
 State Machines and Activity Diagrams - define test stimuli,
observations, test control/invocations, coordination and
actions
 Test Case – Normative test behavior is specified
 Validation Action - performed by a local test component to
inform the arbiter about its local test verdict
 Test Verdict – Result of the executed test (pass, inconclusive,
etc.) Friday, April 24, 2015 5
The UML 2.0 Testing Profile
(U2TP)
 Test Data Concepts
 Wildcards– Handle unexpected events, or events containing many
different values
 Data pools – Associated with test context and include concrete test
data
 Data Selectors - Operations to retrieve test data from the data pool or
data partitions
 Coding Rules - Define the encoding and decoding of test data when
communicating with the SUT
 Time Concepts
 Group defines concepts to constrain and control test behavior with
regard to time
 Timers – Needed to manipulate and control test behavior as well as to
ensure the termination of test cases
 Time Zones – Used to group components within a distributed system,
allowing the comparison of time events within the same time zone
Friday, April 24, 2015 6
A Methodology on MDT Development
 Following must consider when transforming system
design model to test design model
 Define a new UML package as the test package of the system
 Import the classes and interfaces from system design package to test
pkg.
 Start with the test architecture and continue with test behavior
specification
 Two categories of Issues regarding test architecture
and test behavior
 Mandatories– Essential for a test design model with U2TP
 E.g. : SUT, Test Context
 Optional– Specific to test requirement and therefore not always
needed
 E.g. : test control, timers
 Additionally, there are optional and mandatory concepts which can
derive directly from existing system designFriday, April 24, 2015 7
U2TP Concepts & Methodology
on Test Design Model
Development
Friday, April 24, 2015 8
A Methodology on MDT Development
 Test Architecture
 Mandatory
 Assign the classes (in Class diagram) or objects (in Object Diagram) to SUT
 Specify test context listing the test attributes and test cases, also possible test
control and test configuration
 Optional
 Group the classes/objects (except SUT) to define test component – Not needed
for Unit Tests
 To Define the order of the test case execution use the test control
 Activity Diagram – one activity means one test case and activity flow is test flow
in test control specification
 Use Case Diagram – one use case means one test case
 Interaction Diagram use for the Test configuration
 Whenever two components exchange message each other, assign a channel
between them.
 Assign time zones if the test system is a distributed one.
 Provide Coding rule information
Friday, April 24, 2015 9
A Methodology on MDT Development
 Test Behavior
 Mandatory
 Use Interaction Diagrams for the specification of test case. Change the
instances and assign them with stereotype according to their roles.
 Assign verdicts at the end of each test case specification. Usually this is set to
pass
 Optional
 Define test objectives for each test case that is to be specified
 System behavior which are not used for tests should be taken for default.
 Interactions Diagrams like Sequence Diagrams, State Machiens or Activity
Diargrams should use to define this. Verdict Settings for this is either fail or
inconclusive.
 Use wildcards to catch unexpected behavior
 Timers should be derived from time constraint specifications within a State
Machine or Sequence Diagram
Friday, April 24, 2015 10
Test Design Model
Transformation
 Meta-model based transformation
◦ Source meta model is the UML Meta-Model and
Target is the U2TP Meta-Model
 Every mechanism cannot be performed by
transformation such as grouped the test
components or SUT
 Hence use mechanism called test directives and
its meta-model is Test Directive Meta-Model.
 Transformation rules applied to both UML & Test
Directive meta-model to create U2TP meta-
model
 All 3 models are based on MOF (Meta-Object
Facility is an Object Management Group (OMG)
standard for model-driven engineering)
Friday, April 24, 2015 11
Test Design Model
Transformation
Friday, April 24, 2015 12
Test Design Model
Transformation
 Used aspect-oriented, declarative or
pattern-based language to the
Transformation.
 Transformation Rules used for describe
the correspondence between pattern of
elements in source model and target
model.
 Patterns are reusable definitions.
 When patterns are used in the source of
a rule it is an query, but when it is used
in the target, it acts as a template.
 Tracking relationships associate the
source model elements and the target.
Friday, April 24, 2015 13
Test Transformation Example
Friday, April 24, 2015 14
Friday, April 24, 2015 15

Model-Driven Testing with UML 2.0

  • 1.
    Presented By : DilrukG.A. (148209B) Jagoda S.D. (148214K) Friday, April 24, 2015 1 Model-Driven Testing with UML 2.0 Zhen Ru Dai Fraunhofer FOKUS, Kaiserin-Augusta-Allee 31, 10589 Berlin, Germany dai@fokus.fraunhofer.de
  • 2.
    Index …  Introduction Approaches to Model-Driven Testing  The UML 2.0 Testing Profile (U2TP)  A Methodology on Model-Driven Test Development  Test Design Model Transformation  Summary Friday, April 24, 2015 2
  • 3.
    Introduction  The Model-DrivenArchitecture (MDA) is not only about system modeling.  The early integration of testing into the development process becomes more and more important.  U2TP bridges the gap between designers and testers by providing a means for using UML for both system modeling and test specification. Friday, April 24, 2015 3
  • 4.
    Approaches to Model-DrivenTesting Friday, April 24, 2015 4
  • 5.
    The UML 2.0Testing Profile (U2TP)  The Architecture Concepts  System Under Test (SUT) – One or More Object  Test Components – Objects within test system  Test Context - Message between components  Scheduler - Control the test execution and test components  The Behavior Concepts  State Machines and Activity Diagrams - define test stimuli, observations, test control/invocations, coordination and actions  Test Case – Normative test behavior is specified  Validation Action - performed by a local test component to inform the arbiter about its local test verdict  Test Verdict – Result of the executed test (pass, inconclusive, etc.) Friday, April 24, 2015 5
  • 6.
    The UML 2.0Testing Profile (U2TP)  Test Data Concepts  Wildcards– Handle unexpected events, or events containing many different values  Data pools – Associated with test context and include concrete test data  Data Selectors - Operations to retrieve test data from the data pool or data partitions  Coding Rules - Define the encoding and decoding of test data when communicating with the SUT  Time Concepts  Group defines concepts to constrain and control test behavior with regard to time  Timers – Needed to manipulate and control test behavior as well as to ensure the termination of test cases  Time Zones – Used to group components within a distributed system, allowing the comparison of time events within the same time zone Friday, April 24, 2015 6
  • 7.
    A Methodology onMDT Development  Following must consider when transforming system design model to test design model  Define a new UML package as the test package of the system  Import the classes and interfaces from system design package to test pkg.  Start with the test architecture and continue with test behavior specification  Two categories of Issues regarding test architecture and test behavior  Mandatories– Essential for a test design model with U2TP  E.g. : SUT, Test Context  Optional– Specific to test requirement and therefore not always needed  E.g. : test control, timers  Additionally, there are optional and mandatory concepts which can derive directly from existing system designFriday, April 24, 2015 7
  • 8.
    U2TP Concepts &Methodology on Test Design Model Development Friday, April 24, 2015 8
  • 9.
    A Methodology onMDT Development  Test Architecture  Mandatory  Assign the classes (in Class diagram) or objects (in Object Diagram) to SUT  Specify test context listing the test attributes and test cases, also possible test control and test configuration  Optional  Group the classes/objects (except SUT) to define test component – Not needed for Unit Tests  To Define the order of the test case execution use the test control  Activity Diagram – one activity means one test case and activity flow is test flow in test control specification  Use Case Diagram – one use case means one test case  Interaction Diagram use for the Test configuration  Whenever two components exchange message each other, assign a channel between them.  Assign time zones if the test system is a distributed one.  Provide Coding rule information Friday, April 24, 2015 9
  • 10.
    A Methodology onMDT Development  Test Behavior  Mandatory  Use Interaction Diagrams for the specification of test case. Change the instances and assign them with stereotype according to their roles.  Assign verdicts at the end of each test case specification. Usually this is set to pass  Optional  Define test objectives for each test case that is to be specified  System behavior which are not used for tests should be taken for default.  Interactions Diagrams like Sequence Diagrams, State Machiens or Activity Diargrams should use to define this. Verdict Settings for this is either fail or inconclusive.  Use wildcards to catch unexpected behavior  Timers should be derived from time constraint specifications within a State Machine or Sequence Diagram Friday, April 24, 2015 10
  • 11.
    Test Design Model Transformation Meta-model based transformation ◦ Source meta model is the UML Meta-Model and Target is the U2TP Meta-Model  Every mechanism cannot be performed by transformation such as grouped the test components or SUT  Hence use mechanism called test directives and its meta-model is Test Directive Meta-Model.  Transformation rules applied to both UML & Test Directive meta-model to create U2TP meta- model  All 3 models are based on MOF (Meta-Object Facility is an Object Management Group (OMG) standard for model-driven engineering) Friday, April 24, 2015 11
  • 12.
  • 13.
    Test Design Model Transformation Used aspect-oriented, declarative or pattern-based language to the Transformation.  Transformation Rules used for describe the correspondence between pattern of elements in source model and target model.  Patterns are reusable definitions.  When patterns are used in the source of a rule it is an query, but when it is used in the target, it acts as a template.  Tracking relationships associate the source model elements and the target. Friday, April 24, 2015 13
  • 14.
  • 15.

Editor's Notes

  • #4 If I ask a question that how many of you aware about UML system modeling, probably all of you raised your hands saying we know. But when I ask how many of you aware about UML test profile and how to use UML for test modeling, most of you may not aware about this. So in this paper the main contribution is that describing a methodology for how to apply UML 2.0 Test profile concepts to an existing UML system design model effectively in order to retrieve a test design model. So The MDA is not only about system modelling But also can be applied to test modelling. As in the software development process steps, testing and test code generation is done at the last, but it is worth to have early integration of testing into development process. This allow reduction of time and cost. So from the UML 2.0 version it was introduced UML test profile to model system testing, U2TP bridges ,..
  • #5 platform independent system design models (PIM) platform specific system design models (PSM) platform independent test design model (PIT) platform specific test design model (PST)
  • #6 The UML 2.0 Testing Profile provides concepts to develop test specifications and test models for black-box testing. U2TP introduce four main logical concepts which are architeture concepts, behavir concepts, test data concepts and time concepts. Together, these concepts define a modeling language for visualizing, specifying,analyzing, constructing and documenting a test system. One or more objects can be identified as the System Under Test (SUT). Test components are objects within a test system which can communicate with the SUT or other components to realize the test behavior. Test context ….. The scheduler controls the test execution and test components. It is responsible for the creation of test components, a synchronized start of the different test components, and the detection of test case termination.