Setting regular expressions
When you want values of an item type to appear in a certain pattern in the generated test data, you must set the Regular Expression property for that item type in a defined schema.
Before you begin
- You must have logged in to HCL OneTest™ Server.
- You must have created a project and a schema.
About this task
The regular expression is a special text to describe a pattern. For example, you can specify regular expressions for email address, phone number, or website. HCL OneTest™ Data provides you some sample regular expressions.
To set regular expressions to any item type, you can either insert a value or select from the sample list of regular expressions that best suits your testing requirements. HCL OneTest™ Data then validates the value you inserted for the Regular Expression field and generates the values of the selected item type in a similar pattern.
Procedure
- Select your project in HCL OneTest Server and go to the Data Fabrication page.
- Open your schema from the Schemas tab.
- Select the item type for which you want to set regular expressions.
-
Click Regular Expression from the
Properties dialog box.
The sample list of regular expressions is displayed.
-
Set the regular expression in the Regular Expressions field by using any
one of the following methods:
- Type the regular expression. HCL OneTest™ Data then validates the regular expression.
For example, [0-9]{18}
Tip: If you want to reuse the validated regular expression then click Add to sample list, to add the expression in the list. - Select the regular expression from the sample list. The selected regular expression is displayed in the Regular Expressions field.
- Type the regular expression. HCL OneTest™ Data then validates the regular expression.
- Click Save.
Results
You have successfully set the regular expression for the selected item type.
What to do next
You must prepare the structural view of the schema. See Designing a structural view of the schema.