Description

Parent/Child Relationships are defined at the Domain (Template) level when setting up a Project. This should initially be done after importing or creating your Domains.

You'll need to use the Domain Referencing Wizard or manually define them for each Domain. Once defined, you can create a Scenario (a copy of the template). 


Sometimes, the Domain relationship needs to change for a particular Scenario. Changes at the template level cascade down to all Scenarios unless they have been locked at the Scenario level. 


You can define the Parent/Child relationships at the Scenario level for a particular Scenario to achieve the required relation without altering the relationship at the template level.  


In This Article


How Can Relationships be Defined at the Scenario Level?

A Scenario can be created in one of two ways in the GenRocket web platform:

  1. Quick Scenario - A Scenario will automatically be created for the Domain based on defined relationships at the Domain (Template) level. When this is used, changes must be made manually within the Scenario and may require more steps. 

  2. New Scenario - This option provides a little more flexibility. You can choose not to automatically build the Scenario using relationships and still use the Scenario Wizard, which allows you to select the Primary Domain and Parents during Scenario creation. 


This article provides a basic user story and shows how to define the relationship at the Scenario level during Scenario creation and how to make changes to the relationships of an existing Scenario.

Sample User Story

A user has set up three Domains: Teacher, Student, and Subject. At the Domain (Template) level, the Subject Domain is the parent of the Teacher and Student Domains (see below).


In this case, the number of students generated is not dependent on the teacher, and both are only dependent on the subject. Student and teacher are not related to each other.


However, for one Scenario, the relationship needs to change: 

  • The number of generated students should be dependent on the number of teachers.
  • The number of generated teachers should be dependent on the number of subjects.

This does not match the relationship that has been defined at the Domain (Template) level above. To ensure no other Scenarios are impacted, the user defines the relationship for that Scenario at the Scenario level (shown below). 



Note: Changes at the Scenario level do not cascade up to the Domain (Template) level. 


How to Define Parent/Child Relationships Using New Scenario

When creating a new Scenario, users can select the Primary Domain and automatically add referential integrity. This uses the relationships defined at the Domain (Template) level. 


The user also has the option to not automatically add referential integrity when creating the Scenario, which allows them to change the relationship at the Scenario level. These steps are shown below: 

  • In the Project or Domain Dashboard, click on New Scenario.



  • Enter a Name and click Next.



  • Click on Create With Primary Domain.
  • The Primary Domain is the Domain for which the Scenario will generate data.



  • Select a Domain and click Next.



  • Referential relationships should not be used for this example because the user will define them. 
  • Click No in the dialog window to continue.



  • The Scenario Wizard can still be used to build the Scenario based on the user's input. 
  • Click Yes to continue.



  • In this example, the Teacher Domain needs to be the Parent Domain of the Student Domain. 
  • Click Yes.



  • Select the Teacher Domain and click Next.



  • The Subject Domain should be the parent for the Teacher Domain.
  • Click Yes, select the Subject Domain, and click Next.




  • The Subject Domain will not have a parent and is the Root Domain in the hierarchy.
  • Click No.



  • A Sibling Domain is a Domain that depends on the Primary Domain for the Scenario. 
  • In this example, the Student Domain does not have any Sibling Domains.



  • Click Yes to automatically add Referential Integrity based on the above selections.



  • The Scenario will be created as shown below:



  • The relationship for the Scenario is shown below:


How to Make Relationship Changes to an Existing Scenario

This section will cover the steps required to make the above change at the Scenario level for an existing Scenario. In this example, test data will be generated for the Student Domain. The StudentTeacher Scenario was already created using Quick Scenario. 


The Subject Domain will be included in the Student Scenario to maintain referential integrity because the Subject Domain is the Parent of the Student Domain at the template level. 



Step 1 - Add the Teacher Domain as a Scenario Domain

This Domain will need to be added since it was not included in the Scenario automatically. This is because the Student and Teacher Domains are not related at the template level. 

  • Click on Add Domain in the Scenario Dashboard.



  • Select Teacher and click Add.


Step 2 - Change the Parent Domain for the Student Scenario Domain

At the template level, the Subject Domain is the parent of the Student Domain. However, in this case, Teacher needs to be the parent of Student. So, the current parent must be removed from the Student Scenario Domain. 
  • Select the Student Scenario Domain and click on Remove Parent.


  • Click on Add Parent.


  • Select Teacher and click Save.


    Note: Alternatively, you could create the Scenario with a Primary Domain only and use the guidance below to manually add the Scenario Domains, Parents, and References based on testing needs. 

Step 3 - Remove the Subject Attribute from the Student Domain

Since Quick Scenario was used, a reference was automatically added to the Student Domain for the Subject Domain. This reference will need to be removed. 

  • Select Student and click on the Delete (Trash Can) icon for the Subject Attribute.


Step 4 - Add the Subject Domain as the Parent for the Teacher Domain

The relationship is not automatically there since we added the Teacher Domain directly to the created Scenario. So, we must manually define the parent for the Teacher Scenario Domain. 

  • Select the Teacher Scenario Domain and click on Add Parent.



  • Select the Subject Domain and click Save to finish.


Step 5 - Create a Reference to Student

Finally, the reference needs to be added to the Student Domain for the Teacher Domain (Parent).

  • Select the Student Domain and click on Create Reference.



  • Click Yes to continue.



  • A Teach Attribute has been added to the Student Domain as a reference.


Parent/Child Relationship at Scenario Level


Optional Next Steps

  • Generate data for this Scenario by downloading it and using the command (click here). 
  • Create other Scenarios and chain them together for more complex test data (click here). 
  • Set up Test Data Cases to generate different variations and volumes of data based on the defined relationships (click here).