Description

The ListGen Generator generates items in a provided list in sequential or random order. It's a great choice when generating data from a fixed set of values (e.g., lookup table or categorical data). It provides flexibility in generating static but controlled variability in your datasets.


When Should ListGen Be Used? 

  • You need data from a finite, known set of values. 
  • You want to simulate lists commonly used in healthcare, finance, retail, etc. 
  • You require predictable yet varied data outputs for a test (unit, integration, etc.). 


Example Use Cases

  1. Populate a country attribute with specific countries like "USA" and "Canada." 
  2. Assign an order status such as "Pending," "Shipped," or "Delivered."
  3. Cycle through product categories or departments. 
  4. Mimic data users would select through drop-down menus such as roles or security levels.


Note: The ListGen Generator supports up to 15 records. Otherwise, it is recommended to use the ListCSVV2Gen Generator


In This Article



Video Training

The following video can be used to see a quick tutorial on how to use the ListGen Generator: 


Generator Parameters

The following parameters may be configured for the ListGen Generator. Items with an asterisk* are required. 

  • waitAmount* - Defines the number of iterations the Generator should wait before moving to the next item in the list.
  • random* - Randomizes the list when True. Defaults to False.
  • seed - Defines an optional seed for randomization. Using the seed will ensure that the same random data is generated each time data is generated.
  • setLoop* - setLoop gives users the ability to OVERRIDE the loop count at the Scenario Level and ONLY produce the number of rows defined in this list.
  • iterate - Based on the Boolean value, determines when to generate the next value. If the value is True, it generates the next value. If the value is False, it just waits.
  • unique* - When random is set to "True," the unique Parameter determines if the random values must be unique (True) or not unique (False). The default value is "False." 
    • Note 1: When random and unique = True, the loopCount must not exceed the total number of values in the list, a GenRocket exception will be thrown, and the process will be halted. 
    • Note 2: On the GenRocket Web, ListGen will not recognize random = True and unique = True because the number of values may be less than the preview count. 
  • list - Allows users to enter items into the list that they want to be generated. Add one item on each line in the list.
  • resetIndex - Defines whether to restart reading the list from scratch for every generated child row. 


Important Information when setLoop Parameter is True

When the setLoop Parameter is set to "True" for gen1 Generator of an Attribute in a Domain, the loopCount in the Scenario Domain will appear as shown below with N as the loopCount: 



The user will not be able to edit the Loop Count Value. 



The Info Icon can be used to view more information.



If the setLoop Parameter is set to "False," then the loopCount can be modified for the Scenario Domain within the Scenario Dashboard.



How to Use the ListGen Generator

  1. Create or select an Attribute for a Domain. 
    • Click here to learn more.
  2. Assign the ListGen Generator to the Attribute. 
    • Click here to learn more.
  3. Configure Generator Parameters.
    • Use the list parameter to add values.
    • Values can be constant or referenced (e.g., Generator, Attribute, Variable).
    • Use a single click to enter a constant value or a double click to add a reference.
    • Additional parameters can be changed as needed based on your test data requirements. 
  4. Click on Save Generator to save the configuration changes.

Example 1 - Generate Random Colors

This example will generate a color randomly from a list of five colors. The following parameters have been set. 

  • random = True
  • list = red, blue, green, yellow, purple


Sample Output


Example 2 - Generate Order Status (Wait Five Iterations before generating the Next Value)

This example generates an orderStatus for an Order Domain. There are three possible values: Pending, Shipped, and Delivered. The generator will wait for five iterations before generating the next value in the list.

  • waitAmount = 5
  • list = Pending, Shipped, Delivered


Sample Output

The orderStatus Attribute is highlighted below and generates each status for five iterations before moving onto the next value.


Example 3 - Generate Account Status that Changes When Boolean is "True"

In this example, the ListGen will generate five possible status values: active, inactive, suspended, locked, and terminated


The iterate parameter will determine when the generator switches to the next possible value during test data generation. It expects a Boolean value of "True" or "False." You can reference another Attribute or a Generator that generates a Boolean value. 


For this example, the BooleanValueGen has been assigned to the same Attribute and will randomly generate a value of "True" or "False.  



BooleanGen

The default values have been used for this example.

 

Sampe Output

Each time "True" is generated, the ListGen will move to the next value in the list and continue to generate that value as long as the Boolean value is "False."