Story

An Organization needs to generate synthetic test data and populate it into a SQL database for testing based on a Project within the GenRocket web platform. 


To do so, they will need to set up Test Data Cases to generate data meeting specified Unit and Load testing requirements. 


The generated data will be used to validate the data populated into the database and maintain referential integrity.


Actors

  • Project (or Project Version) - The Project Version determines what Domains, Receivers, Scenarios, and Loop Counts are used for the Test Data Case Set.

  • Test Data Case Set - A suite grouping together the Test Data Categories and Test Data Cases necessary to validate synthetic data populated into the database.
     
  • Test Data Categories - Contains the Test Data Cases for a specific type of testing (Unit, Beta, Functional, Stress, etc.).

  • Test Data Cases - Contain the Domains and defined Loop Counts for synthetic test data generation.


Setup Overview

A Test Data Case Set can be configured for the Project with the following to ensure the validity of the test data being populated into the database:

  • 1 Unit Test Data Category with 5 Test Data Cases
  • 1 Load Test Data Category with 1 Test Data Case

Each Test Data Case will generate variations of synthetic data without affecting other users to ensure the right test data is being generated and populated into the database.


Test Data Case Set Example

This example will provide a quick overview of the Project, Domain, Receiver, and Scenario Configuration before showing the information for setting up the Test Data Case Set.


Project Setup

The following shows the Project setup for this example: 

  • Domains - Create four Domains titled Company, Department, User, and Address.


  • Receiver - Create a Global GenericSQLInsertReceiver for all four Domains. You will need to define the database and table information.


  • Scenarios - Define a Scenario for each Domain in the Project or Project Version.


  • Scenario Chain - Chains together all  Scenarios above so they are run at the same time for the Test Data Case Set.

            

To learn more about creating these items for a Project, please see the following articles: 


Parent/Child Relationships for Project Domains

For this example, the following Parent/Child Relationships exist: 

  • Company is the parent of Department.
  • Department is the parent of User.
  • User is the parent of Address.

Note: For more information about how to do this, please see: How do I set relationships between Domains?


The example below shows the Relationship information for the Company Domain:


Test Data Case Set Setup

Multiple steps must be performed to set up a Test Data Case Set with two Test Data Categories and multiple Test Data Cases. The steps are as follows:


Step 1: Create a Test Data Case Set for the Project

  • Select the appropriate Project within the Project Dashboard of the GenRocket web platform.

  • Expand the Manage Menu option for the appropriate Project Version and then select Test Data Cases.


  • Click on Create New Test Data Case Set to create a new set.


  • Enter a Name and click Save. For this example, it will be titled TestDataCaseSetExample.


Step 2: Create Two Test Data Categories: Unit and Load

  • Click on Create New Test Data Category.


  • Select Unit from the provided options and click Save.


  • Perform the same steps again, but choose Load for the category. The created categories will appear as shown below:

     

Step 3: Set Up 5 Unit Test Data Cases with Loop Count Variations

This step will show how to create the Test Data Cases for the Unit Test Data Category and how to change their Loop Counts. 


The following Loop Counts will be set for each of the 4 Domains within each Test Data Case: 

  • Test Data Case 1 - 1 Company, 1 Department, 1 User, 1 Address
  • Test Data Case 2 - 3 Companies, 1 Department, 1 User, 1 Address
  • Test Data Case 3 - 1 Company, 3 Departments, 1 User, 1 Address
  • Test Data Case 4 - 1 Company, 1 Department, 3 Users, 1 Address
  • Test Data Case 5 - 1 Company, 1 Department, 1 User, 3 Addresses


Note: This creates different variations of data that can be used to test the validity of data sent to the database for Unit Testing.


Complete the following steps to set up the Test Data Cases:

  • Select the Unit Test Data Category by clicking on its name. The currently selected category will be highlighted in blue.


  • Click on Create New Test Data Case within the Test Data Case for Unit section.


  • Enter a Name for the Test Data Case and click Save.

  • For this example, the names will be: case1, case2, case3, case4, and case5.


  • Click on the Plus+ within the Actions Column to add each Domain to the Test Data Case.

  • For case1, no other changes will be necessary.


  • Each Domain will appear in the table on the right and will have its own Loop Count.

  • Since this is the first Test Data Case, the Loop Count does not need to be changed for any Domains.


  • To create the next 4 Test Data Cases, use the Copy Test Data Case option for case1 to quickly set up the other cases.


  • Enter a Name for the Test Data Case. Complete the same actions to create the remaining cases.

  • The Test Data Cases section will appear as shown below once finished:


  • The Loop Count will need to be changed for a different Domain within each of the remaining Test Data Cases (case2, case3, case4, and case5).

  • Select the appropriate Test Data Case by clicking on its name. For this example, case2 will be selected.


  • Click on the Configuration Icon for the appropriate Domain Loop Count within the table.

  • For this example, the Loop Count will be changed for the Company Domain.


  • The Loop Count for a Domain will default to the global loop count value (i.e. #{global.Company.loopCount}).


  • Click on the Loop Count Field and change the value to 3.


  • Click Save to finish. The change will appear within the table for the Loop Count Column for the Domain.


  • The Loop Count will need to be changed to the following for the remaining 3 Test Data Cases: 
    • case3 - Department to 3
    • case4 - User to 3
    • case5 - Address to 3

  • Once set, the Preview will show a pattern as shown below:


The following image shows the completed configuration for the Unit Test Data Category and Test Data Cases: 


Step 4: Set Up Load Test Data Category's Test Data Case

The next step will be to set up a Test Data Case for the Load Test Data Category.  

  • Select the Load Test Data Category to view and manage its Test Data Cases.


  • Next, click on Create New Test Data Category.


  • Enter a Name for the Test Data Case. For this example, we will use case1 again.

  • Click Save to finish creating the Test Data Case.


  • Next, click on the Plus (+) for each Domain to add it to the case.


  • Each Domain will appear in the table on the right and have a Loop Count.


  • For this Test Data Case, the following will need to be configured: 
    • Company - Loop Count should be 5.
    • Department - Loop Count should be 10.
    • User - Loop Count should be 100.

  • These will be configured the same way as before when setting up the Unit Test Data Cases.

  • Click on the Loop Count Icon and then change the Loop Count Parameter to the appropriate number.


  • Once the three Domain Loop Counts have been configured, the table will appear as shown below:


  • The Address Domain will be configured differently for this example. For each user, we want to generate 1 to 3 addresses for the load test.

  • Click on the Loop Count Icon for the Address Domain.


  • Next, change the Loop Type to Increasing. This will generate the following sequence: 
    • 1 User - 1 Address
    • 1 User - 2 Addresses
    • 1 User - 3 Addresses

  • The loop will start over again for the next three generated users and so on.


  • You will also need to set the Min Range and Max Range for the Domain Loop Count. 
    • Min Range = 1
    • Max Range = 3

  • This ensures that at least 1 Address will be generated per user and no more than 3 will be generated per user.

  • Click Save to finish.


  • The table will appear as shown below after the Address Loop Count has been configured.


The following image shows the completed configuration for the Load Test Data Category and Test Data Case. 


For the Load Test Data Case, the data generation will be greater than the Unit Test Data Cases due to the higher Loop Counts.

  • Companies - 5 Total
  • Departments - 50 Total
  • Users - 5,000 Total
  • Each User could have 1 to 3 Addresses



Step 5: Download the Test Data Case Set and Scenario Chain

Once all Test Data Categories and Cases have been set up, download the Test Data Case Set and the Scenario Chain to your local computer. 


  • Click on the Download (Cloud) option located on the far right of the table in the Actions Column to download it to your local computer.


  • Click on the Download (Cloud) option within the Scenario Chain section of the Project Dashboard to download it to your local computer.


Step 6: Run the Test Data Case Set with the Scenario Chain

The Test Data Case Set and the Scenario Chain are ran using the command line shown at the bottom of the screen. 


The following is an example of the command line for running case1 within the Unit Test Category



These values will be different depending on the name of the Test Data Case Set and what Test Data Category/Case/Scenario are being run:

  • TestDataCaseSetExample.gtdp - Name of the Test Data Case Set to be run.
  • Unit.case1 - Name of the Test Data Category and Test Data Case to be run.
  • <ScenarioName.grs> - Name of the Scenario or Scenario Chain to run.


Open a Command Terminal and set the directory to where files are downloaded from the GenRocket web platform to your local computer. 



Then replace the appropriate values within the command line.



The Test Data Category, Test Data Case and Scenario Name can be changed accordingly. For example, to run the Unit Test Case: case4 - the line would read: 


genrocket -tdc TestDataCaseSetExample.gtdp:Unit.case4 -r AllScenarioChains.grs


The following example shows what the line would read based on the Project information for this given example: 


genrocket -tdc TestDataCaseSetExample.gtdp:Unit.case1 -r AllScenarioChains.grs


To run a different Test Data Category (i.e. Load), the command line would read:


genrocket -tdc TestDataCaseSetExample.gtdp:Load.case1 -r AllScenarioChains.grs


Additional Information

To learn more about setting up and configuring Test Data Cases for a Project, please see the following pages: