Open topic with navigation
In this section, you analyze how UFT currently recognizes the Book control versus the way it should recognize it, based on your knowledge of the control. Next, you determine the answers to the questions in Understanding the Web Add-in Extensibility Planning Checklist, and fill in the Web Add-in Extensibility Planning Checklist, accordingly.
The best way to do this is to analyze how UFT recognizes the Book control on the one hand, using the Object Spy, Keyword View, and Record option, and on the other hand, to consider how the control is implemented and the purposes for which it is used.
Open UFT and Run the Book control.
Open UFT and load the Web Add-in.
Close any open instances of the Book control and open it by opening the %ALLUSERSPROFILE%\Documents\ExtAccTool\Samples\WebExtSample\Application\Book.htm file.
Use the Object Spy to view the Book properties and operations.
In UFT, open a GUI test and select Tools > Object Spy or click the Object Spy toolbar button to open the Object Spy dialog box. Click the Properties tab and select Identification Properties.
In the Object Spy dialog box, click the pointing hand , then click the Book control.
The Book control is implemented as a Web table, for which UFT support is built in, therefore it recognizes the control as a WebTable, named according to the title of the book. The icon used for the test object is the standard WebTable class icon.
Close the Object Spy.
Record operations on the Book control.
In UFT, select Record > Record and Run Settings to open the Record and Run Settings dialog box. In the Web tab, select Record and run test on any open browser. Click OK.
Click the Record button or select Record > Record. Click on different links in the Book control (you must return to the previous page after each click, to return to the Book control): the book title, the image in the control, an author name, and the Used link.
With each click, a new step is added to the test:
Click the Stop button or select Record > Stop to end the recording session.
Only simple Click steps are recorded, each attributed to a different object defined within the book control. Click operations are recorded independently on Web Link test objects with different names, or on the Book image test object. These steps are not helpfully meaningful in the context of this control.
Determine the custom toolkit to which the Book control belongs.
When you extend UFT support for a control you always do so in the context of a toolkit. For the purpose of this tutorial, two custom Web controls are grouped to form the custom toolkit named WebExtSample: Book and UsedBooksTable.
In this lesson you create support for the WebExtSample toolkit, initially supporting only the Book control.
Complete the custom class support planning checklist.
The Book control is implemented as a Web table, as follows:
<table class="Book"> <tr> <td class="BookImageCell" rowspan="4"> <a href=".\QtpHistory.htm"> <img class="BookImage" alt="Book" src=".\Res\Book.jpg"/> </a> </td> <td class="BookCell"> <a class="BookTitle" href=".\QtpHistory.htm" > The History of QuickTest Professional </a> </td> </tr> <tr> <td class="BookCell"> By: <a href=".\JaneDoe.htm">Jane Doe</a>, <a href=".\JohnDoe.htm">John Doe</a> </td> </tr> <tr> <td class="BookCell"> </td> </tr> <tr> <td class="BookCell"> New: <strong>59.99$</strong> <a href=".\UsedBooks.htm">Used:</a> from <strong>29.99$</strong> </td> </tr> </table>
This section describes the decisions you need to make when planning your support for the Book control, and then summarizes the information in the support planning checklist.
Choose a test object class to represent the custom control:
The Book control is implemented as a Web table control to assist in its appearance. For the purpose of performing tests on this control, there is no need to for UFT to recognize the Book control as a table. On the other hand, the basic support that UFT provides a generic Web element, using the WebElement object, is not specific enough for the Book control. Therefore, you create a new test object class named WebExtBook, which extends WebElement, and teach UFT to identify this test object class as the one that represents the Book control.
Define how UFT will identify which test object class to use to represent the control:
If the control's tagName property is table and its className property is Book, use a WebExtBook test object to represent the control.
Decide the details for the new test object class:
The new test object class is represented by the icon file: <UFT installation folder>\Dat\Extensibility\Web\Toolkits\WebExtSample\Res\WebBook.ico
No Help file is provided.
The new identification properties to support are: title, authors, price, and min_used_price. They should all be displayed in the UFT Checkpoint Properties and Output Value Properties dialog boxes, and be selected by default in checkpoints. None are used for Smart Identification.
The identification properties that uniquely define the object are the book's title and the names of its authors.
The name of the test object itself should be the same as its title identification property.
Decide which test object methods to support for the custom control:
The WebExtBook test object class provides the following test object methods:
Select. Simulates clicking the book's title or image. This is the default test object method.
GoToAuthorPage. Simulates clicking the specified author name (the available author names should be retrieved from the specific control during run-time).
GoToUsedBooksPage. Simulates clicking the Used link.
Determine whether you need to support a dynamic list of values for any method arguments:
Define which of the control's children UFT should learn when learning the control:
For testing purposes, UFT should relate to all operations as though they are carried out on the Book control itself, even if they are technically performed on controls within it. Therefore, none of the control's children need to be learned and represented by test objects.
Decide whether the Object Spy should display WebExtBook test objects: Yes.
Define whether to support recording, and what events to record:
Listen to mouse clicks that occur on the following elements in the control: title, image, authors, and Used. When a click occurs on one of these elements, record the relevant step in the test.