Exercise 15.3 - Creating a Custom SysML-TestRail Mapping
Objectives
The new learning objectives of this exercise are to create a TestRail relationship type in Syndeia, use it to create a custom SysML-TestRail mapping with relationships, and to use the mapping to create a model transform connection. Note that the Syndeia TestRail interface has no default model transform mappings.
Preparation
This exercise assumes the student has
Cameo System Modeler 18.0 - 19.0 (or MagicDraw with SysML plug-in) installed correctly on his or her machine with a valid license for use, and
Syndeia 3.3 installed as a plugin for Cameo/MagicDraw with a valid license for use
Syndeia TestRail interface, correctly installed with a valid license for user.
The user can. It is generally advisable to carry out these exercises in a non-production repository, a "sandbox", set up for training and practice purposes.
We recommend that the student view the videos 1.6, 1.7, and 1.8 in the Introduction Section of the Syndeia training materials before attempting this exercise. These videos provide important background on creating custom mappings. Hands-on tutorials omit much of the logic behind the actions in the interest of clarity and brevity.
We will use the MagicDraw project Syndeia_TestRail_Tutorial.mdzip (get it here - SysML Models, Profiles and Mappings) provided with the tutorials for this exercise, which loads the profile Syndeia_Mapping_Tutorials_Profile.mdzip. We also use the syndeia34Tutorial.mappings file provided, which has been installed in the .syndeia folder and renamed as syndeia.mappings.
For this exercise, you may use any TestRail repository you have available with the ability to create and edit TestRail elements of types Suite, Section and Case.
Example – SysML to TestRail
The SysML model shown in Figure 1 will be used in a model transform to a TestRail repository with the following mapping, which includes both multiple artifact and multiple relationship mappings.
Block (Test Suite) – TestRail Suite
Block (Test Section) – TestRail Section
Block (Test Case) – TestRail Case
SysML PartProperty relationship – TestRail Section - TestRail Case relationship
SysML PartProperty relationship – TestRail Suite - TestRail Section relationship
Figure 1 SysML Starter Model
Exercise
If not already open from the previous exercise, open the SysML project Syndeia_TestRail_ Tutorial.mdzip (get it here - SysML Models, Profiles and Mappings), right-click the top-level package, and launch the Syndeia dashboard. Select a Syndeia Cloud project, if necessary and go to the Mappings tab.
Our first objective is to create a new artifact type, TestRail Suite, that could be used in creating a custom mapping. In the left column, right-click on Syndeia Mappings/M 1 Model Types/TestRail, and open the Add TestRail Artifact Type window.
Select a Repository from the pull-down list under TestRail Repository at the top.
Click Get TestRail Types button. Select TestRail Suite, the TestRail artifact type to be added to the Model Types list.
Edit the name and description fields, if desired.
Enter the ID of an existing artifact of this type in the Template field before clicking the Retrieve TestRail Properties button. This sample artifact should have all the attributes that you wish to be able to map. See "Special Note on TestRail Artifact IDs" at the beginning of Exercise 15.2.
Click Select All to make all attributes available for mapping, or chose a subset by checking or unchecking the boxes in the left column of the attributes table. The final window should look similar to Figure 5
Click OK to save the Artifact type. The new artifact type should appear under Model Types/TestRail in the left column.
Figure 2 The Add TestRail Artifact Type window completed
In the left column, right-click on Syndeia Mappings/1 Model Types/TestRail to open the Add Relation Type window (Figure 3).
Select TestRail Suite – TestRail Section from the pull-down menu under Name.
Click OK and the new relation type should appear under Model Types/TestRail in the left column.
Figure 3Â Add Relation Type window
View an existing mapping Block (Test Section) – TestRail Section (Figure 4) that should already be available in the syndeia33.mappings file provided with this tutorial. This will be used to govern the model transform of the bottom half of Figure 1. Note that it includes a Relationship Type Mapping, PartProperty to TestRail Section – TestRail Case, and a Related Mapping, Block (Test Case) – TestRail Case.
Figure 4 Mappings window, Block (Test Section) – TestRail Section
Create a custom mapping with relationships that will transform the entire model in Figure 1 in one pass.
Right-click the SysML-TestRail mapping group in the left column and select Add Mapping.
Choose Source Artifact Type as Block (Test Suite) from the pull-down menu.
Choose Target Artifact Type as TestRail Suite from the pull-down menu.
Enter Name and Description as shown in Figure 5.
Choose Structure Level as Children Immediate from the pull-down menu.
Choose Include Attributes as Include Attributes from the pull-down menu.
Click Retrieve Available Attribute Definitions below the Attribute Definition Mappings table. Using the Plus button, add the three attribute mappings line-by-line for the Test Plan artifacts as shown in Figure 5.
Choose Include Relations as Include Relations from the pull-down menu.
Using the plus button below the Relation Type Mappings table, add the relationship mapping PartProperty to TestRail Suite-TestRail Section as shown in Figure 5.
Using the plus button below the Related Mappings table, add the related mapping Block (Test Suite) – TestRail Suite as shown in Figure 5.
Click Save Mapping at the bottom before moving on.
Figure 6 Mappings window, Block (Test Suite) – TestRail Suite
Execute the model transform just created by dragging TestRail Mapping::My Test Suite onto a project in TestRail (see Figure 7). Choose the mapping just created, Block (Test Suite) – TestRail Suite.
Figure 7 Connection Manager tab in Syndeia dashboard, drag My Test Plan to JIRA project
Expand the TestRail column and find the new TestRail Suite element, My Test Suite. Right-click My Test Suite and open TestRail. My Test Suite in the TestRail web browser should look similar to Figure 8
Figure 8 My Test Suite in TestRail web browser, showing related Sections and Cases after model transform
From the Syndeia dashboard, Connection Browser or Connection Search tab, execute Compare Source and Target on the connection from My Test Suite. The results should appear the same as Figure 9. Note the relationship on both sides connecting My Test Suite to My Test Section. The id field shows a difference because an id in TestRail was created automatically when the new TestRail Suite was generated. To write this back to the Block (Test Suite) id tag value in SysML, run Sync Target -> Source across the connection.
Figure 9 Comparison Results across My Test Suite Connection
In the SysML model, modify the connections to My Test Suite, as shown in Figure 10.
Add a second part property using the block My Second Test Section.
Figure 10 Modified SysML model
Run Compare Source and Target again from the My Test Suite connection. The results should now appear similar to Figure 11. The part property relationship to My Second Test Section has no equivalent on the TestRail side.
Figure 11 Comparison Results across My Test Suite connection after modifying SysML model
From the Syndeia dashboard, Connection Browser or Connection Search tab, execute Sync Source -> Target on the connection from My Test Suite, then repeat the Compare Source and Target. The results should resolve the differences shown in Figure 11.
Â