27
© 2009 Artisan Software Tools. All rights reserved. Testing Solutions with UML/SysML Andrew Stuart, Matthew Hause

Testing Solutions with UML/SysML

  • Upload
    waldo

  • View
    61

  • Download
    0

Embed Size (px)

DESCRIPTION

Testing Solutions with UML/SysML. Andrew Stuart, Matthew Hause. Agenda. Safety Critical Systems and Testing SysML and Testing Rail Case Study Automotive Case Study Conclusion. Safety Critical Systems and Testing. The Problem We are running out of time. Systems are becoming more complex. - PowerPoint PPT Presentation

Citation preview

Page 1: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved.

Testing Solutions with UML/SysMLAndrew Stuart, Matthew Hause

Page 2: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 2

Agenda

Safety Critical Systems and Testing

SysML and Testing

Rail Case Study

Automotive Case Study

Conclusion

Page 3: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 3

Safety Critical Systems and Testing

The Problem

− We are running out of time.− Systems are becoming more complex.− Time to market is decreasing.− Most important, safety critical systems must be properly tested.

The Solution

− SysML and Model Based Systems Engineering (MBSE)− SysML supports modelling of the requirements, behaviour, structure,

etc.− Can aid the verification, validation, and simulation of software,

firmware and mechanical systems.− SysML can provide a practical solution of integrating testing into an

MBSE approach.

Page 4: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 4

SysML Requirements Flow Down

Requirements are integrated into the model

Supports requirements hierarchies

Verify, Satisfy, Derive, Trace and Refine relationships

«block»Cruise Control System

«requirement»

txtThe CCS must allow a driver to enable the vehicle to maintain adesired speed.

REQ_CCS_01

Maintain Speed

«testCase»[Package] Maintain Speed - with flows

Maintain Speed

«requirement»

txtOnce the CCS is engaged, to activate cruise control the drivercan 'set' the desired speed. Once this is set the CCS shall takeover control of the throttle.

REQ_CCS_05

«requirement»

txtWhen cruise control is engaged, the driver must beable to increment or decrement the desired speed(in increments of 1 MPH). The driver must also havethe ability to change the gear selection whilst thecruise control is active.

REQ_CCS_06

«requirement»

txtWhen cruise control is engaged, the driver must be able toincrement the desired speed in increments of 1 MPH.

REQ_CCS_06a

req [Package] Cruise Control System [Fragment]

«satisfy»

«verify»

«satisfy»

«deriveReqt»

«satisfy»

Page 5: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 5

Physical and Logical Structural Modelling

Parts shown by diamond notation, or by Parts Compartment Compartments show properties of the block Attributes are inherited from the parent

bdd [Block] Cruise Control System

«Block»CC Display Panel

«Block»Toggle Button

«Block»CAN

«Block»CC IO Card

«Block»CC Motherboard

«Block»Inc Speed

«Block»

operationsload gear profile (in gear : Integer)calibrate ()calculate throttle position ()handle EMU message ()

Cruise Control Unit

«Block»Dec Speed

«Block»Push Button

«Block»

operationsupdate display ()

partsCC Disp : CC Display PanelDec : Dec SpeedEng/Dis : Engage/Disengage CCInc : Inc SpeedSet : Set SpeedSus/Res : Suspend/Resume CC

Cruise Control IO

«Block»

partsCCIO : Cruise Control IOCCUnit : Cruise Control Unit

Cruise Control System

«Block»Set Speed

«Block»Suspend/Resume CC

«Block»Engage/Disengage CC

11

CCUmb

11CCUio

11 CANbus

11 Inc 11 Dec

1

1

CCUnit

1

1CCIO

1

1

Set1

1

Sus/Res1

1

Eng/Dis

11

CC Disp allocatedFrom«Class» cThrottle Controller«Class» pAccelerationProfile«Class» pCalibration Manager«Class» cSpeedMonitor

allocatedFrom«Class» eCruiseControlPanel«Class» eEMUIF«Class» eTransmissionMonitor«Class» eBrakePedalMonitor

Page 6: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 6

Internal Block Diagram Shows parts (structural

children) … … and ports (interaction

points on blocks and parts) Supports integration of

behavior and structure Port types

Standard Ports Specify a set of operations

and/or signals Typed by a UML interface

Flow Ports Specify what can flow in or out

of block/part Typed by a flow specification

ibd [Block] Cruise Control System [connections]

«block»Cruise Control System

Page 7: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 7

State Modelling Models Complex state-based behaviour of system elements

Atomic, composite and concurrent states

Conditional behaviour

stm [Block] Cruise Control System

Faultdo : Log Errordo : Disengage

Operatingdo : Maintain SpeedDecrement Reqd Speed/Decrement SpeedIncrement Reqd Speed/Increment Speed

Acceleratingdo : Resume

Suspendeddo : Suspend

Engaged

Idle

Power On

Cruise Control System

[ tes t fa il] /

[e ls e ] /

P ower O ff/

P ower O n/

Engage/Do Initialisation Tests...

CCerror/. . .

Dis engage/

Resume[(Set Speed <> 0)&(Brake Not Engaged)]/

[Set Speed Reached]/

S et S peed/

S us pend/

Suspend operation also called when brake applied or when throttle applied for >20 sec

Page 8: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 8

Activity Modelling

Allows low level behavioural modelling of the system.

SysML Additions

− «streaming» activities consume inputs after initialization

− «continuous» flows

− Probabilities

− Interruptible regions

Maintain Speed

SpeedMsg

EMUMessage

ThrottleMessage

CCUnit

Load Acceleration Profile

Page 9: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 9

Sequence Diagrams

Represents the interaction between collaborating parts of a system

Supports conditional behaviour, loops, parallel, etc.

Interactions can be messages, operations, etc.

Can be used to define test cases

Maintain SpeedDescription

CCUnit:Cruise Control Unit«part»

CCIO:Cruise Control IOref Update Display

«part»:Engine Management Unit

«block»

loop while CC System operational loop while CC System operationalEMU message arrives handle EMU messageload gear profile load gear profile( current gear )calibrate profile and speeds calibrateif reqd speed not = actual speed if reqd speed not = actual speed

calculate reqd throttle position calculate throttle positionsend message to EMU Set Throttle

end if

update CC display update displayend loop

referenced diagram specifies message sequences internall to Cruise Control IO to update the display

Page 10: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 10

Parametric Diagram

Defines parametric relationships between properties

Constraint can be shown in compartment or in attached note

par [block] Vehicle [1]

Vehicle.Mass : kg

Page 11: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 11

Allocation Shown on IBD

Allocations Allocation of activity invocation to parts shown in

allocatedFrom compartment. Allocation of activity object nodes to Item flows

shown via call-outs.

ibd [Block] Vehicle [High Level Systems]

«Block»Vehicle

«BlockProperty»BodySys : Body

Subsystem

«BlockProperty»BrakeSys : Brake

Subsystem

«BlockProperty»CC Sys : Cruise Control System

allocatedFromDecrement SpeedDisengage CCDo Initialisation TestsEngage CCIncrement SpeedLog ErrorMaintain SpeedOperate Cruise ControlResume CCSet Desired SpeedSuspend CC

«BlockProperty»ChasSys : Chassis

Subsystem

«BlockProperty»InteriorSys : Interior

Subsystem

«BlockProperty»LightSys : Lighting

Subsystem

«BlockProperty»PowSys : Power

Subsystem

«BlockProperty»SteerSys : Steering

Subsystem

«BlockProperty»ElecSys : Electrical

Subsystem

Body-ChassisBody-Lighting

Power-Chassis

Brake-CC System

Power-CC System

Steer-Chassis

Body-Interior

Interior-Lighting

Brake-LightingChassis-Brake

Elec-Lighting

Power-Elec

CCSystem-Elec

Interior-Elec

allocatedFrom«Class» Power On Vehicle«Class» Power Off Vehicle

allocatedFrom«Class» Shift Gear«Class» Accelerate Vehicle

allocatedFrom«Class» Brake Vehicle

allocatedFrom«Class» Steer Vehicle

Page 12: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 12

Rail Case Study

Page 13: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 13

Radio Block Control (RBC) Validation Scenario

The RBC is responsible for continuous speed supervision and movement authority of the train. Safety Integrity Level 4 Product.

Eurobalise determines the Train Location and sends it to the RBC

Page 14: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 14

Traditional RBC Validation

Use case requirements model defined in Artisan

− Analysis and design models used sequence and state diagrams

Flowcharts constructed from the mode that capture all possible execution paths

− Sequence diagrams (SD) generated for all valid paths.

− Python scripts generated from the SD

− Scripts exercised SUT

− Not flexible when model changes

RBC UML MODELFLOWCHART

DIAGRAM MODEL

FlowChart Tool Model Analysis

Automatic Generation

All Possible

paths *.xls files

Path Functional Analysis

Valid Functional Path *.xls files

TraceabiltyTest case OSDReport

Documentation

Run Test Against RBC Validation Team

Page 15: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 15

Automated RBC Validation

Eliminates manual work

− Excel files created automatically. Used as evidence.

Reduces human errors

− Originally the files were hand-coded

Decreases the number of files used.

Enforces design standards.

RBC UML MODELFLOW CHART

DIAGRAM MODEL

AUTOMATIC TOOL - MODEL

ANALYSIS

FUNCTIONAL PATH ANALYSIS

REPORT DOCUMENTATION

AUTOMATIC TOOL – DOCUMENT

GENERATION

RUN TEST AGAINST RBC

TEST CASE OSDs

VALIDATION TEAM

All Possible

paths *.xls files

Page 16: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 16

RBC Tool Integration

VB DLL reader imports from the model.

.NET application manages imported information

Provides execution paths

Automatically produces documentation

Decreased validation costs by 75%!

A r ti s a n U M L t o F l o w c h a r t A n a l y s i s a n d M a n a g e m e n t t o o l .

U M L A R T I S A N

M O D E L D I A G R A M S

V I S U A L B A S I C D L L R E A D E R

F u n c ti o n s :- I M P O R T I N F O R M A T I O N

V I S U A L . N E TC O N T R O L

A P P L I C A T I O N T O O LF u n c ti o n s :

• M A N A G E O B T A I N E D I N F O R M A T I O N .• C R E A T E F L O W C H A R T S• O B T A I N A L L P A T H S• C R E A T E / M O D I F Y F L O W C H A R T S M A N U A L L Y• G E N E R A T E * . x l s , * . d o c D O C U M E N T S• C O M P A R E D I F F E R E N T D I A G R A M V E R S I O N S A N D A S S I G N I N F O

F L O W C H A R T * . C T F F I L E

- D i a g r a m r e p r e s e n t a ti o n

- A l l P a t h s i n f o r m a ti o n

U S E R

M A N U A L O P E R A T I O N S

P O S S I B L E P A T H S * . x l s

S T S T E M P L A T E * . d o c

F L O W C H A R T * . C T F F I L EF L O W C H A R T * . C T F

F I L EF L O W C H A R T * . C T F

F I L E

O L D V E R S I O N

F L O W C H A R T * . C T F F I L E

N E W V E R S I O N

F L O W C H A R T * . C T F F I L E

Page 17: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 17

Automotive Case Study

Page 18: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 18

Automotive Platform Independent System Test

Test cases derived from use cases and modelled in sequence diagrams.

White box test cases can be derived from activity diagrams

Test cases automatically generated through a code generator and based on the model.

Executed on thetest rig.

− Results captured.

− Documentation generated

InterfaceDescription

Testdesign Code-Generation Test Scripts

Test Bench

InterfacesMapping Call

Page 19: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 19

Testbench Overview

Provides a configurable remote test of the car thru the I/F

Interface to RTOS and AppUT through pre-defined test interface

Allows mapping of the test to the equipment to be used separately

Test Bench

Real-time Computer

Car SimulationSignals

Parameters

Real-time OS Signals

scripts

SuT

Application Systemscripts

Scripting IF

- Load, Start and Stop Car Simulations- Read Signals

Manipulate the simulation behavior by changing parameters

Page 20: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 20

Testbench Tool Interaction

Dependencies show mapping between variables in test descriptions and parameters and signals performed using name matching

Library holds drivers for each platform.

Test Bench

Real-time Computer

Car SimulationSignals

Parameters

Real-time OSSignals scripts

SuT

Application System scripts

Test Bench Computer

Test System

Test Cases

Variable Mappings

Test Function Library

Reporting System

Scripting IF

STRD Testbench Tool Interaction

Page 21: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 21

Automotive Tool Integration and Workflow

Mapping/Driver(HIL-specific)

Test FunctionLibraries

Test FunctionLibraries

Test Design

Visu

alis

ieru

ngTe

stst

atus

Visu

alis

atio

nTe

stSt

atusCodegeneratorCode Generator Test RunTest Run

Test ProtocolsTest Protocols

Protocol Pool

Test SequencesParameter Sets(Target-Code)

Test SequencesParameter Sets(Target-Code)

Test

kom

posi

tion

Test

Com

posi

tion

Test3Test2

Test1Test3

Test2Test1Test Sequences,

Parameter Sets(XML-Metaformat)

XM

L-E

xpor

tX

ML-

Exp

ort

Reference

Call

Import

CASE-Tool

Page 22: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 22

Description of Automotive Model-based Testing

Shows how test scripts are abstracted in MBD

Scripts cross all levels; the models contain these perspectives.

Model-based Test Design

Test Design using UML

Use Cases

Classes

Sequences

Objects

Interfaces

Test Environment

Test Scripts

Test Bench Computer

Test Bench

TB Interface

1..*1

Test Cases

1..*

1

Test Infrastructure

1..*

1

Test Sequences

*

1

Test Parameters

*

1

runs

Code Generation

describes

Page 23: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 23

Standards for Model-based Testing

Page 24: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 24

UML 2.0 Testing Profile (U2TP) Test Architecture

Created in 2005 for modelling tests

Both case studies use this approach

Can make use of the SysML testcase stereotype.

«metaclass»StructuredClassifier

{Abstract}

«metaclass»Property

«stereotype»TestComponent

zone : TestZone [0..1]

«stereotype»TestContext

arbiter : Arbiterscheduler : Scheduler

«stereotype»SUT

«interface»Arbiter

getVerdict () : VerdictsetVerdict (in v : Verdict)

«interface»Scheduler

startTestCase ()finishTestCase (in t : TestComponent)CreateTestComponent (inout t : TestComponent)Scheduler ()

meta class Test Architecture

Page 25: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 25

Test Case and Test Objective

Test context contains an arbiter and a scheduler (Previous slide)

Test case can be an operation or a behaviour

Test results can be pass, fail, error or inconclusive

Tests generally run using a sequence diagram

Automating test runs not included in U2TP, as it is tool dependent

«metaclass»Dependency

«stereotype»TestObjective

«metaclass»Operation

«metaclass»Behavior

«stereotype»TestCase

«Enumeration»Verdict

passfailerrorinconclusive

meta class Test Case and Test Objective

Page 26: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 26

Conclusion

Test plans can and should be modelled

A model based approach provides the logical progression from:

− Test Plan (and models) to,

− Test Suite(s) (and models) to,

− Test Case(s) (and models) to,

− Test Scripts (and models)

Building models to test models and systems is more natural

ROI has been proven – in this instance saving 75% on testing

Page 27: Testing Solutions with UML/SysML

© 2009 Artisan Software Tools. All rights reserved. 27

Discussion and Comments