How do I use the EvalCaseActionGen?
Description
Emulates multiple if-then-else statements by returning the first 'true' value. It works similarly to EvalCaseGen but allows for multiple equations.
Generator Parameters
The following parameters may be configured for the EvalCaseActionGen Generator. Items with an asterisk* are required.
- var1 - The first of five possible variables to be used in the equation.
- var2 - The second of five possible variables to be used in the equation.
- var3 - The third of five possible variables to be used in the equation.
- var4 - The fourth of five possible variables to be used in the equation.
- var5 - The fifth of five possible variables to be used in the equation.
- default* - Defines the value selected when no cases are met.
-
caseList - Defines a list of cases whose values should return a boolean.
- Case 1: var1 == 10
- Case 2: var1 > 10 AND var1 < 20
- Case 3: (var1 != 20)
-
actionList - Defines the list of actions with each action matching one case.
Example 1 - Generate Status Based on Age
A tester would like to assign a status based on age:
- Age < 18 = Child
- Age >= 18 AND <= 60 = Adult
- Age > 60 = Senior
This example uses two linked Generators: RandomGen and EvalCaseActionGen.

RandomGen (gen1)
Generates a random age between 0 and 120.

EvalCaseActionGen (gen2)
References the age and generates Child, Adult, or Senior based on which of three cases evaluates to 'true.'
- var1 - references RandomGen (gen1)
- default - Error
- caseList
- var1 < 18
- var1 >= 18 AND <= 60
- var1 > 60
- actionList
- Child
- Adult
- Senior
Example 2 - Generate Customer Discounts Based on Loyalty Point Value
A tester wants to generate a sale discount based on each customer's loyalty point value:
- Loyalty >= 80 = 20% discount
- decimal value = 0.2
- Loyalty >=50 AND <80 = 10% discount
- decimal value = 0.1
- Loyalty <50 = 5% discount
- decimal value = 0.05
Note: Decimal point values are used for this example.

This example uses two Attributes:
- loyaltyPoints - generates random loyalty point value between 0 and 100 for a customer.
-
discount - generates discount (in decimal format) based on the loyalty point value for each customer.
loyaltyPoints Domain
A RandomGen will generate a loyalty point amount between 0 and 100.

discount Domain
Uses the EvalCaseActionGen to generate the percentage value in decimal format (20, 10, or 5%) based on the loyalty point amount.
- var1 - references the loyaltyPoints Domain.
- default - 0.00 generated when no cases evaluate to 'true.'
-
caseList - defines the following cases:
- var1 >= 80
- var1 > 50 AND var1 <80
- var1 <= 50
-
actionList - defines the action for a case when it evaluates to 'true.'
- 0.2 (20%)
- 0.01 (10%)
- 0.05 (5%)
Article Feedback: Was this helpful?
Give feedback