The MultiWeightGen Generator can be used to generate child records based on weights. A user can define weights (percentage and value), which determine the number of generated child records for each parent record.

In This Article


A tester needs to generate n number of addresses for each generated user where n is dynamic. For this example, ten user records will be generated and each user record will need to have n number of addresses based on the following weights.

PercentageNumber of Addresses
50%2 addresses
20%3 addresses
30%1 address

Project Setup

A Project has been created with a default Project Version. The Project Version contains two Domains: 

  • User Domain
  • Address Domain


Parent/Child Relationship

The User Domain is the parent of the Address Domain: 

User Domain loopCount

The User Domain loopcount has been set to "10."

Receiver and Scenario

A DelimitedFileReceiver and Address Scenario has been added to the Address Domain.

Step 1: Add a new Attribute to the User Domain

The new Attribute will determine how many addresses are generated for each user based on weights.  For this example, a childLoopCount Attribute has been added, and the Attribute's Visible Parameter has been disabled.

Step 2: Assign the MultiWeightGen Generator to the Attribute

Replace the default assigned Generator with a MultiWeightGen Generator. Complete the following steps to do so:

  • Select the new Attribute.
  • Enter MultiWeightGen into the Quick Generator Replacement Menu.
  • Then click on the Replace button.

Step 3: Enter Percentages and Values for the MultiWeightGen Generator

Next, the following Percentages and Values will need to be entered for the MultiWeightGen Generator. 

PercentageNumber of Addresses
50%2 addresses
20%3 addresses
30%1 address

Complete the following steps: 

  • Enter each Percentage and corresponding Value within the input field for the valueList and percentageList Parameters.

  • Change the exactPercentage Parameter to "True."

  • Click the Save Generator button when finished.

Step 4: Reference the Attribute for the Address Scenario Domain loopCount

Next, the added Attribute will need to be referenced for the loopCount within the Address Scenario Domain. Complete the following steps: 

  • Double click on the loopCount Value for the Address Scenario Domain.

  • Within the Domain Attributes Tab, select the Scenario Domain (e.g., User Domain).

  • Then click on the Plus (+) for the Attribute (e.g., childLoopCount).

  • Click on the Disk icon to save this change for the Address Scenario Domain.

It will now show "N Address for Each User," and the weights for the childLoopCount Attribute will determine how many addresses are generated per user. 

Step 5: Download and Run the Scenario

Once these changes have been made, the Address Scenario can be downloaded and run to generate test data. This can be done from the Scenario Dashboard by clicking on the Download button.

Completed Story

The output file for this example is shown below: 

The number of addresses for each user in the output file is broken down as follows: 

  • 2 Users have 3 Addresses (20%)
  • 3 Users have 1 Address (30%)
  • 5 Users have 2 Addresses (50%)