What Are Conditions and Actions?

A Test Data Rule (GRule or G-Rule) can have one or many Conditions and Actions, forming a conditional If-Then Statement. A sample If-Then Statement is shown below: 

If (Account.balance <= 1000)
Then (Customer.acccountType == Bronze)


IF Statements can be compounded with an AND or OR as well. For example:

If (Account.type == Bronze) OR (Account.type == Gold)
Then (Account.rewards == false)


A Condition represents the IF portion of a conditional statement for 1 Domain and 1 Attribute. Conditions can also be combined using an AND or OR.

If (Account.balance <= 1000)


An Action represents the THEN portion of a conditional statement for 1 Domain and 1 Attribute. A rule can have one or multiple Actions.  

Then (Customer.acccountType == Bronze)


In This Article


Types of Conditions and Configuration Options

A Condition defines what criteria must be met for a corresponding action to take place. A Condition can be:

  1. Value-Based - The condition is based on a constant value (e.g., true, false, yes, no). 
  2. Variable-Based - The condition references a variable (e.g. Domain Attribute).

     

The following options are available when adding a condition to a rule:


Option
Required
Description
DomainYesA Domain from the Project Version the Test Data Rule Suite belongs to.
AttributeYesAn Attribute from the Domain selected for the Condition.
QualifierYesThe qualifier determines how certain or absolute the Condition is in relevance to the Value.

The following Qualifiers are available for a Condition.
  • Equal To ==
  • Greater Than >
  • Greater Than or Equal To >=
  • Less Than <
  • Less Than or Equal To <=
  • Not Equal To !=
ValueYesThe Value that corresponds with the Qualifier. (Example - if Account.balance < 1000). A value may be entered manually or double-click to select a variable to reference.
Is StringNoThis box will automatically be checked when the entered Value is a String and may be altered when needed.
ConditionYes

Used to form conditional statements where one or more conditions must be met for the defined actions to occur. 

  • AND - The added condition must be met along with other defined conditions for the rule.

  • OR - At least one of the defined conditions must be met. It can be the currently defined condition or another condition added to the rule.

  • THEN - This option should be selected when defining the last condition for the rule. Selecting THEN shows that all conditions have been defined, and an action will occur if one or more are met.
GroupNoEnter a name to set up brackets for the condition. Example: if (type=child && age<=10) or (type=child && age <=18), then action.

For example, the first set of brackets could be labeled as Group A and the second as Group B.

A Group Name is optional when setting up a Test Data Rule Condition.



How to Add Value-Based Rule Conditions

  • Select the Rule and click on Add Condition.



  • Select the Domain, an Attribute, and a Qualifier.
  • Enter a Value that will be used to evaluate the condition.
  • Select a Condition (e.g., AND, OR, THEN).
  • Optionally, a Group Name if brackets are to be used.
  • Click Save to finish.


  • The condition will appear as shown below. An additional condition has been added in the screenshot below:


How to Add Variable-Based Rule Conditions

  • Select the Rule and click on Add Condition.
  • Select the Domain, an Attribute, and a Qualifier.



  • Double-click the Value field to reference a Variable (Domain and Attribute)
  • The variable will be used to evaluate the condition to determine whether it has been met.


  • Select a Domain and an Attribute.


  • Select a Condition (e.g., AND, OR, THEN).
  • Optionally, enter a Group Name if brackets are to be used.
  • Click Save to finish.


  • The Value Column will show the referenced Domain and Attribute.


Type of Actions and Configuration Options

An Action defines what will occur when one or more Conditions for the rule are met. An Action can be set up to do one of the following: 

  1. Value-Based - Assign a specific value to the selected Attribute 
  2. Generator-Based - Use a Generator to assign the value to the chosen Attribute

     

The following options are available when adding a condition to a rule:


Option
Required
Description
DomainYesA Domain from the Project the Test Data Rule Suite belongs to.
Attribute YesAn Attribute from the Domain selected for the Action.
Value TypeYesThis is the value type that will be used to assign the value to the attribute:
  • Constant - A defined string, number, or other value (true, false, yes, no, 100, etc.).
  • Generator - The selected Generator will assign a value.
ValueYesThis is the Value that will be assigned when a Condition is met. It is required when 'Constant' is chosen for the Value Type.

For example: If (Account.balance < 1000), Then (Account.type == Bronze).
"Bronze" is the assigned Value in this example.
Select GeneratorYes
The selected Generator(s) will be used to assign a value to the selected Domain Attribute when a Condition is met. It is required when 'Generator' is chosen for the Value Type.

For example: If (User.age >= 18), Then User.voterRegistrationNumber will have a value assigned from the RandomGen Generator. This generator will assign a random number as the user's voter registration number.
Is StringNoThis box will automatically be checked when the entered Value is a String and may be altered when needed.


How to Add Value-Based Rule Actions

  • Select the Rule and click on New Action.


  • Select the Domain and an Attribute.
  • Select 'Constant' for the Value Type.
  • Enter the Value. It will be assigned to the selected Attribute when one or more Conditions are met.
  • Click Save to finish.


    Note: The Is String option will be automatically checked when the entered value is a string and not checked for numeric values.



How to Add Generator-Based Rule Actions

  • Select the Rule and click on New Action.
  • Select the Domain and an Attribute.
  • Select Generator as the Value Type.


  • One or more Generators can be selected. Multiple Generators will be linked automatically. 
  • Click on the Select Generator field and enter part or all of the Generator name. 
  • You may also select the Generator from the provided drop-down menu.



  • Click on the field again and type the name to add another Generator.

  • Click Save to finish.


  • You will be redirected to the Generator Management Dashboard to make configuration changes for the selected Generator. 

  • Generators can be added, removed, linked, and configured for the Action. Once all changes have been made, click the Save button.


  • Here are the configurations for the three Generators in this example: 
    • ConstantGen Generator - Creates a constant value of B to place in front of the registration number.


    • RandomGen Generator - Creates a random number between 100000 and 999999.

       
    • ConcatGen Generator - This Generator references the values generated by the ConstantGen and RandomGen Generators and combines them into one data value for the Action.


  • The generated data value for the customer's registration number when their account type is Bronze will appear as shown below: