It is a way of representing data using symbols. They are often used within matching, searching or replacing algoeithms. Regular expressions enables us to perform the following tasks.
- Pattern matching and replaces.
- Searching and replace.
- Replace
- Identifying required number or string.
Text strings get assigned to pattern property of a RegEx object.
Regular Expressions in UFT-
Regular expressions can be used in UFT for identifying objects and text strings with varying values.
Where we use regular expression -
- Defining the property values of an object in Descriptive Programming for handling dynamic objects.
- For Parameterizing a step.
- Creating Checkpoints with varying values.
Using Regular Expressions in UFT-
We can define a regular expression for a constant value, a data table parameter value, and Environment parameter value or a property value in Descriptive programming.
We can define a regular expression in standard checkpoint to verify the property values of an object, we can set the expected value of an object's property as a regular expression so that an object with a varying value can be verified.
We can define the text string as a regular expression, when creating a text checkpoint to check that a varying text string is displayed on our application, for example XML Checkpoint we can set attribute or element values as regular expressions.
RegExp Object
VB Script is providing RegExp object for defining Regular expressions, it provides simple support for defining regular expressions. RegExp comes with predefined properties and methods.
Properties :
- Global Property
- IgnoreCase Property
- Pattern Property
Methods :
- Execute() method
- Replace() Method
- Test() Method
Global Property -
Global property accept two values
No comments:
Post a Comment
Note: only a member of this blog may post a comment.