When test data is generated through the GenRocket web platform, it is based on each Domain's Attributes and their configured Generators. Sometimes logic is necessary to achieve the desired output for certain conditions.
For example, let's say user data is being generated and only users falling with a specified age range can be allowed to participate. If this test data is generated without logic, then users with the wrong age may be allowed to participate.
Business logic contains the necessary conditions and actions for ensuring only users with the appropriate ages are able to participate. The following would be a simple example of two Test Data Rules and their Conditions/Actions:
Test Data Rule 1
IF (User.type == child && User.age <= 17) THEN User.allowedToParticipate == false
Test Data Rule 2
IF (User.type == adult && User.age >= 18) THEN User.allowedToParticipate == true
Test Data Rules can be used to set up and test business logic for data generated by Domains within a Project or Project Version. Each Test Data Rule contains one or more Conditions and Actions, which are applied during data generation.
- Test Data Rule Set - A group of Test Data Rules that can be downloaded and ran with a selected Scenario or Scenario Chain.
- Test Data Rule - Defines the conditions to be met for a specified Domain and Attribute and the actions to be performed when those conditions are met.
- Condition - A case that must be met for a specified action to take place during data generation.
- Action - What will take place when the condition is met for the defined Domain and Attribute.
- Test Data Default - A default rule which is used when no other Test Data Rule Conditions are met.
How Do Test Data Rule Sets Work?
Test Data Rule Sets consist of one or more Test Data Rules, which contain business logic for defined Domains and Attributes within a selected Project or Project Version.
This logic ensures the appropriate Actions are taken when certain Conditions are met. These Actions are used to obtain the right outcome when generating test data.
A user can set up their own Test Data Rule Sets consisting of one or more Test Data Rules, which contain the logic necessary to correctly generate required test data.
The following apply to any added Test Data Rule Set:
- A Project (or Project Version) can have one or multiple Test Data Rule Sets.
- A Test Data Rule Set may have one or multiple Test Data Rules.
- A Test Data Rule may have one or multiple Conditions and Actions.
In the visual example below, each Test Data Rule has two Conditions and one Action. Both Conditions must be met for the rule before the defined Action can be taken for the record.
Test Data Rule Sets need to have the following to meet minimum configuration requirements:
- 1 Test Data Rule
- 1 If Condition
- 1 Then Action
Once a Test Data Rule Set has been set up, it can downloaded and ran with any Scenario or Scenario Chain within the Project. The defined Receivers will be used to generate the output data.
The following example shows a Test Data Rule Set that has been set up for a Project with 1 Domain: User.
This Domain has the following 5 Attributes:
- id - Identifier for the Domain.
- name - Full name of the user.
- age - Age of the user.
- type - Type of user (Child, Teenager, Young Adult, or Adult).
- allowedtoVote - True or False
With this example, there are two Attributes that rely on the Age Attribute to generate the appropriate data:
- The Type Attribute (Child, Teenager, Young Adult, and Adult) should be assigned based on the Age Attribute. For example, if the age is 11, then the user should be a child. However, if the age is 25, then they should be a young adult.
- The allowedtoVote Attribute is assigned based on the Age Attribute as well. For example, if the age is 16 then allowedtoVote should be False. However, if the age is 30, then allowedtoVote should be True.
- If 12 or below, then child (not allowed to vote)
- If 13 to 17, then teenager (not allowed to vote)
- If 18 to 25, then young adult (can vote)
- If 26 and up, then adult (can vote)
When no business logic exists for the generated data, a user may be a teenager who is 25 and allowed to vote or an adult may be 18 and not allowed to vote.
Test Data Rules will need to be defined to ensure the right user type is assigned based on age and that only the appropriate ages are given the ability to vote.
Below is a screenshot example of the entire Test Data Rule Set Each rule covers a specific set of conditions based on the user's Type and Age.
To see a step-by-step instruction for the example above, please see: Test Data Rule Set Example: Voting.
For information on how to configure and manage Test Data Rule Sets, please see the following pages:
- How to Access and View Test Data Rule Sets for a Project
- How to Add a New Test Data Rule Set to a Project
- Adding and Managing Test Data Rules for a Set
- How to Use Test Data Defaults
- Configuring Test Data Rule Conditions and Actions
- How to Download and Run a Test Data Rule Set with a Scenario
- Managing Organization Variable Sets for Test Data Rule Sets
- How to Create a Copy of a Test Data Rule Set
- How Do I Change the Name of a Test Data Rule Set
- Viewing Test Data Rule Reports
- How to Lock and Unlock Test Data Rule Sets
- How to Delete a Test Data Rule Set from a Project