STEPlib SysML: How To model Test Data¶
This page explains how use MagicDraw to model Test Data that can then be converted into sample implementation data or files for implementers. Test data can be for many purposes, the example described in this guide is for Test Data to illustrate a usage scenario.
The Test Data is modelled using SysML Instance Specifications.
Contents:
Prerequisites¶
This guide assumes that the following already exist:
- Domain Model (see How to model the Application Domain Model of STEPLIB)
- A model for the Test Data (see Create a new Application Protocol (AP) for instructions on creating models)
Step by Step guide¶
The video shows the steps in this process.
Create a new package and Object Diagram¶
The packages are used to structure the implementation technology specific sample data. For example for the file exchange XML, the <DataContainer>s reflect the first level of packages.
Having created suitable packages, add an Object Diagram to the packages. The Object Diagram is available from General list for the Expert filter.
Add new Instance Specifications¶
The Test data is modelled using SysML Instance Specifications.
New Instance Specifications are created by dragging the Instance from the menu onto the diagram. This will open a Select Classifier dialog as shown below. Turn the filter off to be able to see the Domain Model entities. This will also show all other entities including the Core Model, so hover the mouse over the block icon to show the namespace tool tip to tell which is which. The type-in box at the top can be used to filter the list.
Edit the name, either in the diagram or in the tree.
The default display is to show all the public slots with values. This will include elements from the mapping that were provided with default values, typically for classifications. These should be hidden using the Edit Compartments
Setting Slot values¶
There are two methods for setting values for the slots:
Using Links in the diagram¶
Links are created between entities on the diagram. These can be new Instance Specifications (as described above) or existing Instance Specifications can be dragged from the tree onto the diagram.
The process for creating links is as follows:
Create a new link either by hovering over the entity and selecting the link icon, or by selecting the Link from the controls
Select the entity to link to.
If there are properties linking the two types in the Domain Model, it will popup a Select Association dialog
- Only valid links should be created, therefore it the Select Association dialog does not appear the link should be deleted
- The Select Association dialog will list the properties in both directions.
- Select the association(s) and click OK (multiple associations can be selected)
A Create Slots will appear for each checked association in the previous step. Leave it at the default and press OK
The diagram will now show the link and the newly set slots.
Using Specification dialog¶
It is possible to create and edit the Slot values using the Specification dialog. This is accessed using double-click or Enter from diagrams or the tree.
The following are of interest:
- The Slots are shown by selecting in the left tree
- The Slots are listed alphabetically and grouping by their owning block can be toggled on/off
- Slots with a value are shown in bold with the circular slot icon
- Slots with no value show the rectangular property icon with a letter showing the type of property (C=Constraint, P=Part, R=Reference, V=Value)
- The list shows both the public and private properties. Only the public should be set and these can be identified by the UpperCamelCase naming convention
- Set a slot value by selecting and then clicking on Create Value
Depending on the type of property being edited different options are presented (see figure below):
- Part and Reference Properties - a Select Instance Specification dialog is presented to select the other entity
- Value Properties of Enumerations - the enumeration is displayed as a drop-down list on the right of the Specification dialog
- Other Value Properties - a type-in panel is displayed on the right of the Specification dialog