Description

GenRocket is a test data generation solution capable of creating conditioned data for Salesforce. This article explains why conditioned data is important, goes over the benefits of generating conditioned data, and provides an example for generating conditioned data.


In This Article


Why is Conditioned Data Important?

Conditioned data is useful because it does the following: 

  1. Enables more realistic demo data.
  2. Enables better functional testing.
  3. Enables deeper integration testing.
  4. Zero Data Pruning


Benefits of Generating Required Conditioned Data

  1. Able to produce just about any kind of required conditioned data.
  2. Able to generate the precise data you need to test specific business logic (integration testing).
  3. Able to control the type of functional data you want your prospective clients to see.


Example Story

The following data needs to be generated for a Salesforce Object.

  • Generate 100 Salesforce Opportunities - Within these opportunities; we want to condition the data for two fields: Accounts and StageName.

  • Randomly Distributed Across 20 Accounts - We need to retrieve 20 Ids from Salesforce so that we can control the random distribution of these accounts throughout the opportunities.

  • Set the value of the StageName field - We want to generate a set of values to meet the following conditions:
    • 40% should be closedLost or closedWon
      • 20% should be closedLost
      • 80% should be closedWon
    • 60% should be any of the other StageName values
      • randomly chosen


Step 1 - Generate 100 Salesforce Opportunities

To Generate 100 Salesforce Opportunities, you will need to change the loopCount for the Domain Scenario. This information can be viewed from the Scenario Dashboard. 


  • Click the Edit (Pencil) icon to change the Loop Count Value.


  • Enter 100 for the value.

  • Click the Save (Disk) icon to save the change.


Step 2 - Dynamically Retrieve 20 Account IDs

Next, we will need to dynamically retrieve the 20 Account IDs so they can be randomly distributed throughout the opportunities. To do so, we will use the SFQueryGen Generator for the accountId Attribute.

  • Select the accountId Attribute within the Domain Dashboard.


  • Type SFQueryGen to replace the currently assigned Generator.

  • Click the Replace button.


  • The Generator configuration is shown below with the following changes: 
    • seed = global.Opportunity.seed
    • grVar1 = id
    • query = SELECT grVar1 from account order by id limit 20

  • The SELECT statement will dynamically query the first 20 Salesforce Account IDs in real time.


  • Click the Save Generator button once finished.


Step 3 - Produce the Conditioned Data

Two more Generators will be used to produce the necessary conditioned data: MultiWeightGen and ListGen. Three Attributes will be used to accomplish this. 


Step 3a - stageClosedList Attribute

The stageClosedList Attribute uses the MultiWeightGen Generator.

  • Click on the stageClosedList Attribute in the Domain Dashboard.


  • Click on the valueList field to enter the two values: Closed Lost and Closed Won.

  • Click on the percentList field to enter the two percent values: 20 and 80.

  • Remember to click the Save Generator button after making changes.


Step 3b - stageAllList Attribute

The stageAllList Attribute will use the ListGen Generator to randomly generate the remaining stageName values.

  • Click on the stageAllList Attribute in the Domain Dashboard.


  • For this Attribute, the Generator configuration has been altered: 
    • random = True
    • List - 8 values have been entered and are shown below.

  • Remember to click the Save Generator button to save any changes to the configuration.


Step 3c - stageName Attribute

The stageName Attribute uses the MultiWeightGen Generator to generate stageClosedList values 40% of the time and stageAllList values 60% of the time. 

  • Click on the stageName Attribute within the Domain Dashboard.


  • The stageClosedList and stageAllList Attributes have been referenced in the valueList.

  • 40 has been entered as the percentage for the stageClosedList Attribute reference.

  • 60 has been entered as the percentage for the stageAllList Attribute reference.

  • Remember to click the Save Generator button after making changes.


Completed Story

As shown in the preview data below, the stageName column contains a combination of the stageClosedList and stageAllList Attribute values combined with the additional stageName list values.


In the sample data set below of 20 records, the following applies: 

  • Closed Lost/Won - 8 records (8 divided by 20 = 40%)
  • stageName Values - 12 records (12 divided by 20 = 60%)


Video Training

The following video can also be used to see this example in action. Please note that some screens may appear differently due to version differences.