Updating Table Elements

Applies to TestComplete 14.20, last modified on September 11, 2019

Elements of the Tables collection are used in tests to verify data of controls that display data in the tabular form. Each table element stores values and the full name of the object to be used for comparison.

You can update data stored by elements replacing them with data retrieved from the actual table. You can do that in the Table Element editor, from tests or from test logs.

Updating Table Elements in the Table Element Editor

To update the stored data of the desired Table element in the Table Element editor, open the desired element in the editor and click Update.

TestComplete will load the data from the table object specified in the Table object edit box and store it in the element.

Updating Table Elements From Tests

You can update the contents of the table elements by using the Compare, Check or CompareWithObject method of the Table object or using table checkpoints. Usually the methods and table checkpoints are used to compare stored values against the actual contents of the control, but they can also replace values stored in the element with the control’s data instead of comparing them.

To activate this behavior, enable the Update table elements option in the Stores Options dialog. When this option is enabled, the methods and table checkpoints retrieve data from the control specified by the Table element’s properties.

The following code demonstrates how to use the CompareWithObject method for updating stored tabular data:

JavaScript, JScript

var tableView = Aliases.Orders.MainForm.OrdersView;
// Replaces data stored by the OrdersTable table with data contained in the tableView object
// Instead of comparing them
Tables.OrdersTable.CompareWithObject(tableView);

Python

tableView = Aliases.Orders.MainForm.OrdersView
# Replaces data stored by the OrdersTable table with data contained in the tableView object
# Instead of comparing them
Tables.OrdersTable.CompareWithObject(tableView)

VBScript

Set tableView = Aliases.Orders.MainForm.OrdersView
' Replaces data stored by the OrdersTable table with data contained in the tableView object
' Instead of comparing them
Tables.OrdersTable.CompareWithObject(tableView)

DelphiScript

var
tableView : OleVariant;

tableView := Aliases.Orders.MainForm.OrdersView;
// Replaces data stored by the OrdersTable table with data contained in the tableView object
// Instead of comparing them
Tables.OrdersTable.CompareWithObject(tableView);

C++Script, C#Script

var tableView = Aliases["Orders"]["MainForm"]["OrdersView"];
// Replaces data stored by the OrdersTable table with data contained in the tableView object
// Instead of comparing them
Tables["OrdersTable"]["CompareWithObject"](tableView);

Updating Table Elements From Logs

If a table checkpoint that uses a Table element for comparison fails during the test, after the test run is over you can update the Table element’s contents from the test log. For more information on how to do this, see Updating Table Checkpoints.

See Also

About Tables Collection
Modifying Table Elements
About Table Checkpoints
Updating Table Checkpoints

Highlight search results