Skip to main content

How to use Regular Expression in QTP

Value Configuration Overview

Quickest enables you to configure the values for properties and other items by defining a value as a constant or a parameter. You can also use the “regular expressions” for some values to increasing the flexibility & adaptability of your tests. For details on regular expressions, see Regular Expressions Overview.

Some dialog boxes, such as the Checkpoint Properties dialog boxes, include a Configure value area, which you can define the value for a selected item as a constant or a parameter. In other contexts, such as the Keyword View, Step Generator, and Object Repository window, you can select a value directly and parametrize it or define it as a constant.

Constant. A manually defined value that remains unchanged for the duration of the test. In certain contexts, you can define a constant value using a regular expression.

Parameter. A value that is defined or generated externally and is retrieved during a run session. For example, a parameter value may be defined in an external file or generated by QuickTest.

When you define a value as a parameter, you can also specify other settings according to the parameter type. For more data on using parameters in your tests, see Parameterizing Values.

Regular Expressions Overview

A regular expression is the string of that specifies a complex search words. Through using particular characters, such as period (.), caret (^), asterisk (*), & brackets ([ ]), you can defined the condition of a searching.

Regular expressions are used to describe objects & text string varying with variable values. You can use regular expressions to instruct Quick test to find a value that matches a particular pattern or condition instead of a specific hard-coded value.

Use case examples

Whenever a QuickTest feature supports regular expressions, the relevant QuickTest dialog box includes a Regular Expression check box. Selecting this check box teaches QuickTest to deal the provided value as a regular expression. Some dialog boxes that contain a Regular Expression check box, also contain a right arrow adjacent to the text box for the value. Clicking this arrow enables you to select regular expression characters from a drop-down list, and to test your regular expression to make sure it suits your needs. For more information, see Smart Regular Expression List and Regular Expression Evaluator.

The following are some examples of situations in which you can use regular expressions:
  • When defining the belongings values of an objective in dialog boxes and in programmatic explanation
  • When defining expected variables for checkpoints
  • When defining pop-up window situations in a recovery scripts

You can use the regular expressions only for values of type string.

For details on defining regular expressions, including regular expression syntax, see Regular Expression Characters and Usage Options.

This section also includes:
  • Regular Expressions for Property Values
  • Regular Expressions in Checkpoints
Regular Expressions for Property Values
If you expect the value of an object property in your application to change in certain path during each run session, you can use the regular expression when defining identification property values, for example, in the Object Repository window, or in programmatic descriptions. For more information on programmatic descriptions, see Programmatic Descriptions.
For example, your Web site may include a form in which the end user inputs information & clicks on the Send button to submit the form. When a required field is not complete, the form is a show again for the end user is completed. When feeding back the form, the end user clicks on the resend button. You can define the value of the button name property as the regular expression, so quick Test ignores this variation in the button name when identifying the button in your application.

.


Tip: QuickTest provides a tool to test your regular expressions to help you make sure that they suit your needs. For more information, see Regular Expression Evaluator. QuickTest provides a list of commonly used regular expression characters that you can select when creating a regular expression. For more information, see Smart Regular Expression List.

Regular Expressions in Checkpoints
When creating a criterion checkpoint to conform the property values of object, you can sets expected value of the object property as the regular expression so that an object with a varying the value can be verified.
For example, suppose you need to checks every window & dialog box in your application include the name of your application followed through a hyphen (-) & an explained title. You can adds checkpoint for each dialog box object in your test to check that the firstly the part of the title is includes the name of your application followed via a “hyphen”.
When developing a text checkpoint to checks a varying text string is displayed on your application, you can defined text string as the “regular expression”.
For example, when booking a flight in the “Mercury Tours” sample Website, the final cost charged to a credit card no. should not be less than $300. You can define the cost as a regular expression, so that QuickTest will ignore variation in the text string as a long as value not is less than $300.
You can implement the same rules to any checkpoint type whose dialog box includes a”Configure Value” area same to that described in Configure Value Place.
For example, for table checkpoints you can sets the cell values as the regular expressions, & for XML checkpoints you can sets the attribute and element values as the regular expressions. For extra information on specific checkpoint characters, see the applicable section for the checkpoint type.
Tip: QuickTest provides a tool to test your regular expressions to help you make sure that they suit your needs. For more information, see Regular Expression Evaluator. QuickTest provides a list of commonly used regular expression characters that you can select when creating a regular expression. For more information, see Smart Regular Expression List.

Comments

Popular posts from this blog

Why Driven Testing Important for every Software Tester

Context driven testing, Tester have to set their own path to complete their testing objectives, Test product, test documentation and test deliverable. The meaning of context-driven testing is project capture application of skill and opinion. Tester start testing with context driven testing it is very easy to understand and test application, therefore testing is a human activity that involves a great deal of skill to do well. The context-driven software testing methodological analysis indicates for continuous and creative valuation of testing opportunities. A tester always wants to do testing with context driven testing. It’s a very good practice to hands of explore and able to be proud of that work.   Why we need context driven testing- Context driven methodology like as agile process. Agile methodology generally depends on all-inclusive of unit tests. But in context driven testing, tester have to knowledge on unit testing as well testers will change, In context driven te...

Want to know about Mobile Application Testing? Came to right place

What is Mobile Application Testing ? Mobile Application Testing is a phenomenon of testing functionality, usability and consistency of application software designed for mobiles. It is done in two ways: Automated and Manually. When you buy a new mobile, various applications came pre-installed and some you install as per your need from mobile software distribution platforms such as Google Play, Nokia Store etc. In the recent years, mobile devices had shown a rapid growth rate .  Factors that give an open challenge to Mobile application Testing : 1. Mobile devices models : Different models have different hardware configurations, input methods (some are QWERTY, some are touch while others are normal). 2. Several different operating systems (OS) : Market  is full of availability of different operating  systems  (   Android , IOS, BREW, BREWMP, Symbian,   Windows Phone , and   BlackBerry   (RIM)).Each operating system is unique in ...

SELENIUM TESTING: SELENIUM IDE (& its installation)

In our previous post of selenium testing, we discussed selenium testing briefly. But it was just an introduction about that. And the selenium is much wider in its own. In today’s article, we are going to discuss the selenium, IDE Tool. What is Selenium IDE?? In selenium testing, selenium IDE (Selenium Integrated Development Environment) is a simple tool present in selenium suite Selenium IDE has an inbuilt record and playback functionality that allow us to create tests very quickly, easily and efficiently. Selenium IDE is very easy to install and use. As selenium IDE is a Firefox plugin, it aims to support Firefox browser only. Therefore, we can execute our created test scripts on Firefox only. Selenium IDE supports auto complete mode which allows the user to: * Enter commands more quickly *Restricts the user to enter invalid commands. The most impressive thing about the Selenium IDE in selenium testing that the user need not to have any prior knowledge of pr...