AMSS Lecture 10: Evaluating & Testing UML
Models
Traian-Florin Șerbănuță
2025
Agenda
Goal
Learn how to evaluate, validate, verify, and test UML models using
structured techniques and common tools.
General evaluation
principles
- Why evaluate UML models?
- Model quality criteria
- Static evaluation techniques
- UML conformance checking
- Model simulation & execution tools
- Testing scenarios and behavioral models
General Evaluation Principles
Why Evaluate UML Models?
- Models are abstractions → may be ambiguous or incomplete
- Early detection of design problems reduces cost
- Ensures consistency across the system architecture
- Supports automated transformations and code generation
Evaluation dimensions
- Consistency
- Completeness
- Correctness
- Usability
- Maintainability
Evaluation dimensions: Consistency
- Ensures uniform use of notation, naming, and style across all UML
diagrams.
- Avoids contradictions between different diagram types (e.g., class
vs. sequence diagrams).
- Increases clarity and coherence throughout the model.
Evaluation dimensions: Completeness
- All required system elements, behaviors, and interactions are
represented.
- No missing components that hinder system understanding.
- Covers all relevant viewpoints needed by stakeholders.
Evaluation dimensions: Correctness
- Follows UML syntax and semantic rules.
- Accurately reflects system requirements and domain
constraints.
- Contains no logical, structural, or behavioral errors.
Evaluation dimensions: Usability
- Diagrams are easy for stakeholders to read and interpret.
- Uses an appropriate level of detail—neither too abstract nor too
cluttered.
- Supports communication, documentation, and decision-making
processes.
Evaluation dimensions: Maintainability
- Diagrams can be easily updated as the system evolves.
- Minimizes unnecessary complexity to accommodate future
changes.
- Encourages modular, scalable architecture representation.
UML Model Quality Criteria
Semantic quality
- Are the diagrams logically correct?
- Do they represent valid domain concepts?
Syntactic quality
- Do diagrams follow the UML meta-model?
- Are constructs used properly?
Pragmatic quality
- Are diagrams understandable to stakeholders?
- Are they readable and not over‑complex?
Static Evaluation Techniques
Checklist-based evaluation
Useful for manual reviews.
Typical questions
- Do all classes have well-defined responsibilities?
- Are associations properly navigable?
- Are sequence diagrams consistent with class diagrams?
Benefits
Improves model quality early, reducing rework during
coding.
Better communication among stakeholders.
Supports teaching and training for junior modelers.
Makes model reviews faster and more systematic.
Limitations
- Checklist quality determines quality of evaluation.
- may miss semantic issues if the checklist is shallow.
- does not replace automated validation tools
- e.g., UML consistency checkers
Traceability checks
Goal
ensure that every element of a UML model is properly linked to other
artifacts across the software lifecycle
- Requirements → Use cases → Sequence diagrams → Classes
- Detect missing or redundant elements
What Do You Check in UML Traceability?
Use Cases – Requirements
Use Cases
– Interaction Diagrams (Sequence/Communication)
Interaction Diagrams –
Class Diagrams
Class Diagrams – State
Machine Diagrams
Design Models – Test Cases
Cross-diagram consistency checks
Goal
multiple UML diagrams describing the same system do not contradict
one another
- Messages in sequence diagrams correspond to operations in
classes
- State diagram transitions match methods/events
Types of Consistency
Syntactic Consistency
- Ensurees diagram elements are used correctly according to UML rules
across diagrams.
- Example: Using the same notation for multiplicity or
stereotypes.
Semantic Consistency
- Ensures diagrams describe the same meaning.
- Example: Sequence diagram says “validateOrder()”, but no such
operation exists in the class diagram.
Behavioral Consistency
- Ensures system behavior is logically coherent across diagrams.
- Example: A state transition occurs only if an event is possible in
the sequence diagram.
Naming Consistency
- Names of classes, attributes, operations, events, and states must be
the same across all diagrams.
- Example: “CustomerAccount” vs “ClientAccount”.
Interactive Exercise
Identify 3 possible inconsistencies in the following
class diagram:
Possible solution
- A
DoorSensor doesn’t logically belong to heating
TemperatureSensor - HeatingController is backwards
- associations are unqualified.
Tools for UML OCL Consistency Checking
Expressing constraints using OCL
invariants
context Meeting inv: end > start
action triggers as pre-conditions
context Meeting::shift(d:Integer)
pre: isConfirmed = false and d>0
post conditions
context Meeting::shift(d:Integer)
post: start = start@pre + d and end = end@pre + d
Simulation and Execution Tools
Sequence diagram execution
- Animate interactions
- Highlight active lifelines
- Execute state machines
State machine simulation
- Visual debugging of transitions
- Event injection
- Coverage measurement (visited states)
Activity diagram execution
- Token-based simulation
- Deadlock/livelock detection
Testing Behavioral Models
Model-Based Testing (MBT)
Use the UML model as the basis for generating tests.
- Sequence diagrams → Interaction tests
- State machines → Transition coverage tests
- Activity diagrams → Path tests
State-Based Test Example
For a DoorSensor state machine:
- States:
Closed, Open,
Alert
- Transitions:
doorOpened, doorClosed,
alarmTriggered
Test coverage:
- Visit all states
- Trigger each transition
- Evaluate guard conditions
Cross-Model Evaluation
- Every event in a state machine appears in a sequence diagram
- Every lifeline in a sequence diagram corresponds to a class
- Every operation message matches a method signature
- MagicDraw/Cameo (robust cross-diagram
analyzer)
- Enterprise Architect (dependency matrix +
traceability)
- Papyrus (custom validation rules)
Interactive Exercise
What should happen? What can go wrong? Design test cases.
Produce: 1. A list of possible failure points
2. A state-based test
3. A message-based consistency check
Wrap‑Up
- Evaluating UML models prevents early design flaws
- Tools support: syntax checking, semantic validation, simulation
- Model-Based Testing connects behavioral diagrams with executable
tests