Description

The SwitchGen Generator can be used to choose between values generated by 2 or more Generators based on defined cases for an EDI Segment Attribute. 


Example: Sometimes an EDI Segment may have multiple dates, which must be applied based on a specific qualifier. A good example might be the following: 

  • Start Date
  • End Date


These two dates should not be the same when generating test data and the SwitchGen Generator can be used to ensure these vary by a specified amount of days, months, or years.


Sample Story

This example will use the two dates mentioned above: Start Date and End Date. The tester needs the End Date to be at least 3 days after the Start Date


Each of these dates has a Time Qualifier within the EDI Segment, which will be used to assign appropriate date for the generated data record.: 

  • 64 - Start Date
  • 61 - End Date


To ensure the right date is used for each data record, three Generators will need to be added and configured for the Attribute. The completed configuration is shown below: 



Step-By-Step Instructions

To configure the SwitchGen Generator to select between 2 dates based on a time qualifier code based on the sample story, complete these steps: 

  1. View the date02 Attribute
  2. Set up a Generator for the Start Date
  3. Set up a Generator for the End Date
  4. Set Up the SwitchGen Generator for the Attribute


Step 1 - View the date02 Attribute

  • Jump to the Domain for the EDI Segment.


  • Here is the configuration for the timeQualifer01 Attribute in the selected EDI Segment:


  • Select the date02 Attribute to set up the necessary Linked Generators including SwitchGen.


Step 2 - Set Up a Generator for the Start Date

For the first Generator, complete these steps: 

  • Under Linked Generators, edit the Alias for Gen 1 to show 64.
  • This will make it easier to identify the Generator based on Time Qualifier.


  • Next, make the following changes to the Generator configuration:
    • Format: yyyyMMdd
    • startRange: -3
    • nextBy: Day

  • Click on Save Generator to save the changes.


Step 3 - Set Up a Generator for the End Date

  • Underneath Linked Generators, click on Add Generator.


  • Browse for the FlexibleDateRangeGen Generator.
  • Click on the Generator or the Plus (+) to select it.


  • Change the Alias to 61 to match the Time Qualifier.


  • Make the following Generator configuration changes: 
    • Format: yyyyMMdd
    • startRange: 1
    • endRange: 3
    • nextBy: Day


  • Click on Save Generator to save your changes.


Step 4 - Set Up the SwitchGen Generator for the Attribute

  • Underneath Linked Generators, click on Add Generator.


  • Browse for the SwitchGen Generator.
  • Click on the Generator or the Plus (+) to select it.


  • Change the Alias to Switch for easy identification.


  • Double click on the Switch field to reference the timeQualifier01 Attribute.


  • Click on timeQualifier01 within the pop-up window.


  • Add two cases to the caseList: 64 and 61. 
  • Click on the field at the bottom and enter a case value.
  • Press the Enter Key.


  • Next, double click on the field within the actionList to reference a generator for the first case.


  • Select the Attribute Generator Tab.
  • Click on Gen1 to select it.


  • Complete these steps again to add a second reference for Gen2.
  • The completed actionList will appear as shown below:


  • Click Save Generator to save your changes.


Completed Story

Once this configuration has been set up, you can click on the Preview Tab to see a preview of the values generated by each Generator.


As you can see below, the dates are at least 3 days apart for each Time Qualifier.