Programmatic Descriptions Of Objects In QTP

Using Programmatic Descriptions In QTP(Quick test pro)

When QuickTest Pro learns an object in your application, it adds the appropriate test object to the object repository. After the object exists in the object repository, you can add statements in the Expert View to perform additional operations on that object. To add these statements, you usually enter the name (not case sensitive) of each of the objects in the object's hierarchy as the object description, and then add the appropriate operation.

For example, in the statement below, username is the name of an edit box. The edit box is located on a page with the name Mercury Tours, and the page exists in a browser with the name Mercury Tours.

Browser("Mercury Tours").Page("Mercury Tours").WebEdit("username")

Because each object in the object repository has a unique name, the object name is all you need to specify. During the run session, QuickTest finds the object in the object repository based on its name and parent objects, and uses the stored test object description for that test object to identify the object in your application.

You can also instruct QuickTest to perform operations on objects without referring to the object repository or to the object's name. To do this, you provide QuickTest with a list of properties and values that QuickTest can use to identify the object or objects on which you want to perform an operation.

Such a programmatic description can be very useful if you want to perform an operation on an object that is not stored in the object repository. You can also use programmatic descriptions to perform the same operation on several objects with certain identical properties, or to perform an operation on an object whose properties match a description that you determine dynamically during the run session.

In the Test Results, square brackets around a test object name indicate that the test object was created dynamically during the run session using a programmatic description or the ChildObjects method.

For example, suppose you are testing a Web site that generates a list of potential employers based on biographical information you provide, and offers to send your resume to the employer names you select from the list. You want your test to select all the employers displayed in the list, but when you design your test, you do not know how many check boxes will be displayed on the page, and you cannot, of course, know the exact object description of each check box. In this situation, you can use a programmatic description to instruct QuickTest to perform a Set "ON" method for all objects that fit the description: HTML TAG = input, TYPE = check box.

There are two types of programmatic descriptions:

  • Static. You list the set of properties and values that describe the object directly in a VBScript statement.

  • Dynamic. You add a collection of properties and values to a Description object, and then enter the Description object name in the statement.

Using the Static type to enter programmatic descriptions directly into your statements may be easier for basic object description needs. However, in most cases, using the Dynamic type provides more power, efficiency, and flexibility. Below are the ways to get onto the Programming the description of the objects.

  • Entering Programmatic Descriptions Directly into Statements

  • Using Description Objects for Programmatic Descriptions

  • Retrieving Child Objects

  • Performing Programmatic Description Checks

Post a Comment


Close Menu