Creating HTML Table Checkpoints in Scripts

HTML Table Checkpoint Extension

Select language for code samples HTML Table Checkpoints

Creating HTML Table Checkpoints in Scripts

This topic describes how to create an HTML Table checkpoint and insert it into script code. For information on how to insert HTML Table checkpoints into keyword tests, see HTML Table Checkpoints in Keyword Tests.

Note: You can only create HTML Table checkpoints for web pages that are displayed in web browsers supported by TestComplete, because the test scripts have access to elements in these web pages.

To create an HTML Table checkpoint, follow these steps:

  • You can create HTML Table checkpoints both during script recording and at design time:

    • To create the checkpoint during script recording, select HTML Table Checkpoint from the Recording toolbar:

      Creating HTML Table Checkpoint at Recording Time
    • To create the checkpoint at design time, select the HTML Table Checkpoint from the toolbar of the Code Editor.
      Creating Manual Checkpoint at Design Time
  • After selecting the HTML Table Checkpoint toolbar item, the Create HTML Table Checkpoint dialog will appear.

  • In the dialog:

    • Specify the name of the checkpoint.

    • Specify the source HTML table by dragging the Finder Tool icon to it.

    • Set the Report difference option. If this check box is selected, then the created checkpoint will post messages on the differences between the compared tables to the test log. If the check box is clear, no messages will be posted to the log.

    • Press OK to close the dialog.

Upon closing the dialog, TestComplete will check whether your project contains the Stores project item, the XML collection and the specified element. If the project does not have any of these items, TestComplete will display dialog boxes asking to create them.

After the table is added to the XML collection, TestComplete generates the comparison code. If you create the checkpoint during script recording, the generated code will be inserted into the recorded script automatically. So, you can continue recording after the Create HTML Table Checkpoint dialog is hidden.

If you create the checkpoint at design time, TestComplete will invoke the Copy Text to Clipboard dialog with the generated code in it. You can then copy this code in the dialog and paste it in your script code. Below is an example of the generated code:

Show Example

Show ExampleHide Example

VBScriptCopy Code

If (Not  HTMLTableCheckpoint.Compare("MainHTMLTableCheckpoint", Sys.Process("iexplore").Page("http://www.automatedqa.com/").Table("MainTable"), True)) Then
  Call Log.Error("The MainHTMLTableCheckpoint HTML table checkpoint failed")
End If

JScriptCopy Code

if (!HTMLTableCheckpoint.Compare("MainHTMLTableCheckpoint", Sys.Process("iexplore").Page("http://www.automatedqa.com/").Table("MainTable"), true))
  Log.Error("The MainHTMLTableCheckpoint HTML table checkpoint failed");

DelphiScriptCopy Code

if not HTMLTableCheckpoint.Compare('MainHTMLTableCheckpoint', Sys.Process('iexplore').Page('http://www.automatedqa.com/').Table('MainTable'), true) then
  Log.Error('The MainHTMLTableCheckpoint HTML table checkpoint failed');

C++Script, C#ScriptCopy Code

if (! HTMLTableCheckpoint["Compare"]("MainHTMLTableCheckpoint", Sys["Process"]("iexplore")["Page"]("http://www.automatedqa.com/")["Table"]("MainTable"), true))
  Log["Error"]("The MainHTMLTableCheckpoint HTML table checkpoint failed");

The generated code includes a call to the HTMLTableCheckpoint.Compare method of the HTMLTableCheckpoint object. This method returns True or False according to the comparison results. The method has a required reportDifference parameter that specifies whether the method should post notifications about the differences to the test log. If this parameter is True, the method posts warning messages about each difference that was found (the warning message type is used because some tests may expect that the stored and actual data differs, that is, in general, a difference is not an error). If the reportDifference parameter is False, the method does not post any message to the test log.

See also
HTML Table Checkpoints | HTML Table Checkpoints in Keyword Tests

© 2009 AutomatedQA Corp.
Send feedback on this topic