Description

A JSON File can be imported into GenRocket to automatically create the Domains and Attributes defined within the file. When importing a JSON File a few additional items will be automatically created: 

  • Merge Domain - The Merge Domain merges the created Domains together for test data generation. 

  • Scenarios - A Scenario contains the instructions for generating data and will be created for each imported Domain. 

  • Scenario Chain Set - A Scenario Chain Set combines multiple Scenarios, which can be run as one command line in sequence for test data generation within a Command or Terminal Window. 

  • Configuration File - A Config.xml file is created automatically and used by the JSONSegmentMergeReceiver within the Merge Domain to inform the Receiver how to merge the data segments, segment files, and elements that were part of the imported JSON File. 

Sample JSON File

The following JSON File will create 2 Domains with their own Attributes. 

  • user -> id, grade, name, and age
  • address -> address1, city, state, and zip


{ "user": {
      "id": "0001",
      "grade": "5",
      "name": "Tom",
       "age": "10",
       "address":{
            "address1": "A/234",
            "city": "Chicago",
            "state": "IL",
            "zip": "60607"
             }
        }
}



If Attributes have been defined initially in the JSON File without a Domain Name, a Domain titled GRoot will be created with those Attributes. A file for this example would appear similar to what is shown below: 


{
  "id": "0001",
  "name": "John",
  "age": 15,
  "address" : {
    "address1" : "127 Street",
    "city": "Houston"
  }
  
}



How to Import Domains from JSON

  • In the Projects Dashboard, select a Project and navigate to the Domains Pane.

  • Open the New Domain drop-down menu.



  • Click the Import from JSON option.



  • Click the Choose File button to select the JSON file containing the Domains to be imported.



  • The Output Format Type should be JSON.
     

  • Click the Save button to complete the import.


    Note: If a message appears after clicking on the Save button, there is a problem with the file that will need to be resolved before the import can be completed.


  • The following dialog message will appear on the screen to show that the request has been sent to the queue.


  • The request will appear within the Queue Status Pane until finished.


    Note: You will receive an automated email when the JSON import has started and once the import has finished.

  • Once finished, your Domains will appear within the Domains Pane along with a Merge Domain, which merges the imported Domains data into one.



  • Each Attribute will be part of the corresponding Domain. Receivers and Scenarios will be automatically assigned as well for test data generation based on the imported JSON file. 



  • A Scenario will be automatically created for each Domain and appear within the Scenarios Pane.



  • A Scenario Chain will also be automatically created for generating the merged data in a Command or Terminal Window.



  • Finally a Configuration File will also be created and configured as part of the import. This file is used by the Merge Domain.