Posted September 10, 2010
New TestComplete HTML Table Checkpoint – Simplify Creation of Tests for Web Applications
Web developers use TABLE elements to display tabular data on their web pages or to set the desired
layout for the page contents. Cells of HTML tables contain various types of data: from plain text and
images to nested tables and complex child elements.
To simplify the task of comparing HTML Table elements within TestComplete, we implemented a special
HTML Table checkpoint. It automates the verification of TABLE elements and lets you compare them with
some baseline data using just one test command.
The checkpoint is implemented as a TestComplete script extension. It provides a special dialog, in
which you can interactively specify the TABLE element to be checked, and extends the TestComplete
scripting engine with a new
HTMLTableCheckpoint object that performs the comparison of TABLE elements
with baseline data.
This script extension supports the following versions of TestComplete and web browsers:
- TestComplete ver. 7.52 and 8.0
- Internet Explorer ver. 7 and 8, Firefox ver. 3.5 and 3.6
Download and Installation
Important: The script extension requires MSXML 4 to be installed.
You can download the HTML Table Checkpoint package from the AutomatedQA web site:
matedqa.com/images/blog/HTMLTableCheckpoint/HTMLTableCheckpoint.tcx (135 KB)
Important: Check the extension of the downloaded file. By default, the file has the .tcx extension and is associated with TestComplete. Some web browsers can automatically change the extension to zip. If this happened in your case, you need to change the extension back to .tcx before proceeding with the plug-in installation. For information on changing file extensions, see Windows documentation.
Double-click the downloaded file in Windows Explorer.
This will invoke the Installing Extension dialog.
In the dialog, specify the folder where the extension will be installed and click OK.
If you have TestComplete running, then you need to update the list of installed script extensions.
To do this:
- Select File | Install Script Extension from TestComplete’s main menu. This will invoke
the Script Extensions dialog.
- In the dialog, click Reload. You will see the checkpoint under the Checkpoints
- Close the dialog.
After the checkpoint is installed, you will see its icon in the Tools toolbar:
How It Works
The HTML Table checkpoint is based on the XML checkpoint.
When you command TestComplete to create a HTML Table checkpoint, the test engine displays a dialog
allowing you to pick the desired web TABLE element from the screen.
The checkpoint then saves the contents of this TABLE element to an .xml file and adds the file
reference to the Stores | XML collection of your test project. The structure of the saved .xml file
depends on the structure of the table’s rows and cells and their ID attributes. The textual content
is stored based on the
of HTML elements (these properties are provided by web browsers).
When verifying the table data, the checkpoint compares the table’s actual contents with the
stored .xml file. The HTML Table checkpoint reports results using the XML checkpoint log type.
During comparison, the checkpoint ignores the order of rows in the table. Also, the checkpoint
verifies only textual data of cells. Images and ActiveX objects are ignored.
How to Create an HTML Table Checkpoint
You can create HTML Table checkpoints both during script recording and at design time. Let’s see
how you can do this at design time (creation of the checkpoint during test recording is similar):
Open the tested web page in your web browser.
In TestComplete, select HTML Table Checkpoint from the Code Editor’s toolbar:
Note: to create the checkpoint during script recording, you select this item from the Recording
Selecting the toolbar item invokes the following dialog:
In the dialog, drag the Finder tool () to some text within the desired TABLE element of the tested web page. While you are
dragging, TestComplete will highlight the objects under the mouse cursor.
After you selected the desired table, the dialog will display the names of the found TABLE
In our case, the dialog displays only one item. Several items are displayed if you chose an element
that resides in a nested table.
Choose the appropriate table in the list, enter the checkpoint name into the Name edit box
and click OK.
The checkpoint will generate the verifying script statements and display them on screen:
As you can see the generated script includes a call of the
method. This method uses the following two parameters:
- The first parameter specifies the baseline data (on the image above, it’s the MyCheckpoint item of the Stores | XML collection).
- The second parameter specifies the script object that corresponds to the checked TABLE element.
- The third parameter is optional. It can be either True (default) or False. It specifies whether the
method will post information on differences to the test log.
Click Copy to copy the statements to the clipboard and then paste them to your script
After you run the test with the checkpoint, you can see the results in the test log:
To view detailed comparison results, click Details. As we have said above, the HTML Table checkpoint uses the XML Checkpoint log view:
Currently, you can inset the HTML Table checkpoints into script code only. To use the checkpoint in
keyword tests, you may use the Call Object Method or Run Code Snippet keyword-test operations.