.. comment
all inline tags to start with _ihow_testData_
.. index:: pair: Test Data; How to
.. _ihow_testData_top:
######################################################
STEPlib SysML: How To model Test Data
######################################################
.. include:: /pages/common/pageunderconstruction.txt
:start-line: 3
This page explains how use |MD| 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:: Contents:
:local:
:depth: 2
:backlinks: top
=============
Prerequisites
=============
This guide assumes that the following already exist:
* Domain Model (see :ref:`how_dm_top`)
* A model for the Test Data (see :ref:`gs_tlt_newAP` for instructions on creating models)
.. figure:: /images/howto/ht_testdata_prereq.png
:scale: 100%
Prerequisite model setup for Test Data
================
Example Scenario
================
.. rst-class:: expand
------------------
Scenario
------------------
.. include:: testdataScenario.txt
==================
Step by Step guide
==================
.. contents:: Steps:
:local:
:depth: 1
:backlinks: top
.. index:: Video; How to model Test Data
.. index:: Test Data; How to - Video
The video shows the steps in this process.
.. raw:: html
----------------------------------------
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 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.
.. figure:: /images/howto/ht_testdata_ObjDiag.png
:scale: 100%
Object Diagram selection
--------------------------------
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.
.. figure:: /images/howto/ht_testdata_newInst.png
:scale: 100%
Object Diagram selection
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**
.. figure:: /images/howto/ht_testdata_hideslots.png
:scale: 100%
Hide Slots with default values from mapping.
------------------------------
Setting Slot values
------------------------------
.. contents:: There are two methods for setting values for the slots:
:local:
:depth: 1
:backlinks: top
^^^^^^^^^^^^^^^^^^^^^^^^^^^
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.
.. figure:: /images/howto/ht_testdata_link.png
:scale: 100%
Using Links in the diagram to set Slot values.
^^^^^^^^^^^^^^^^^^^^^^^^^^^
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**
.. figure:: /images/howto/ht_testdata_propsDialog.png
:scale: 100%
Property Dialog for editing Slots.
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
.. figure:: /images/howto/ht_testdata_props.png
:scale: 100%
Different editors for Reference/Part, Enumeration and Value properties.
=================
Export
=================
see :ref:`how_scpt_testdata_top`
.. sectionauthor:: |Judith Crockford|
.. include:: /keywords.rst