The following example illustrates how you can use Web Add-in Extensibility to improve the UFT One support of a custom control.
The Book control shown below represents a book sold on the Internet. This control is not specifically supported on UFT One.
This control contains information including the title of the book, its authors, the price for a new copy of the book, and the lowest price for which a used copy can be purchased.
Clicking on the title of the book opens a page with more details about the book. Clicking on an author name opens a page with a list of books by the same author. Clicking on Used opens a UsedBooks page, listing all of the available used copies of the book, and their prices.
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>
Therefore, if you point to this control using the Object Spy, UFT One recognizes it as a WebTable object named according to the title of the book. The icon used for the test object is the standard WebTable class icon.
If you record on the Book control without implementing support for it, the Keyword View looks like this:
In the Editor, the recorded test looks like this:
Note that 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.
If you use Web Add-in Extensibility to support the Book control, the result is more meaningful. UFT One recognizes the control as a WebExtBook test object (still named according to the book title) and uses a different icon. The identification properties include relevant information, such as authors and min_used_price, which provide the names of all the book's authors and the lowest price for which a used copy can be purchased.
When you are ready to create a test on the control, the Select, GoToAuthorPage, and GoToUsedBookPage methods are supported. These methods can be recorded or you can select them manually in the Operation column of the Keyword View. When recording a test, both clicking on the book's image and clicking its title result in a Select step being recorded.
You can also create a checkpoint to check the value of identification properties, for example, authors (that provides a string comprised of all the books authors).
In the Keyword View, a test created by recording the same user operations as the test shown above looks like this:
In the Editor, the test looks like this:
This test is more meaningful and relevant for the Book control's functionality.