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

Steps To Hunt the Bugs Successfully

The testers should catch the bugs in software that they’re testing. Testers should try to catch as several vital bugs as soon as possible. Catching the crucial bug earlier on Product-Life-Cycle can save the Projects from financial losses & mitigate the risks as compared for catching the same at a later stage in SDLC. Steps to hunt the bugs: Sometimes it’s useful to break the rules: The following test cases, which were predefined a tester can miss the bugs so it makes it impossible’s to provide the product i.e. 100 percent bug free. If you-follow pre-determined test cases you risks becoming blind to outside the bugs. A first secret is to check the functionality under the test. It’ll be an effective channel to discover the more bugs, because functionality is not generally covered by the test cases. Examine the patterns: You might have noticed that the bugs can be often met in the groups, one can call them-gregarious. The testing a new but the similar functionality...

Cross browser testing Tools

Cross Browser testing It is a process to test the web apps across multiple browsers. It involves the checking compatibility of the app across multiple web browsers & ensures that your web app’s works correctly across different web browsers. Tools for Cross Browser Testing Browser shots: The browser shots might be most exhaustive cross browser-testing tool that exists. Browser Shots includes all of most popular-browsers, like Firefox, Chrome, & Safari, along with the tons of another browser’s that might sound unfamiliar, like Sea Monkey, Flock, & Iceape. You can adjust the resolution, color-settings, & even Flash and JavaScript settings. Cross Browser Testing: It allows users to test their websites with over the hundred resolution or browser and Operating System combinations. This also has support to mobile web-browsers, which is crucial because the web traffic is making shift from the primarily desktop computer users to primarily mobile ...

Mobile Application Testing: Strategy for Development

There are a huge number of demands and lots of competitions in the mobile application industries. In that demands and competitions, the mobile application testing has become more important. The testing phase of the mobile application testing looks like evil between the creative process and excitement of new products in the market. According to the survey, “In US, on an average 2-3 hours per day people spends their time on smartphones and tablets. On that time, they spent 80% on mobile application and remaining 20% on web applications.” Few list of key factors for successful mobile application testing strategies are: Selection of Device for Testing : Before introducing the mobile application test activities, first select the devices for testing the application. Selection decision is very important because only devices can help to targets maximum numbers of the customers for accessing the application. There are two parts for device selection: §   Device Model ...