Check Method

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

Use the Check method to compare the values stored in the Table project element corresponding to the Table object with the data displayed in the control whose name is stored in the element’s properties (the name is returned by the ObjectName property).

Using the Check method you can also update the data stored in the Table element. TestComplete does this if the Update Table elements option is enabled. See Modifying Table Elements.

Declaration

TableObj.Check()

TableObj An expression, variable or parameter that specifies a reference to a Table object
Result Boolean

Applies To

The method is applied to the following object:

Result Value

In comparison mode, if the table’s data coincides with the saved baseline copy, the method returns True and posts a checkpoint message () to the test log. Otherwise, the method returns False and posts an error message () to the log.

In update mode the method always returns True.

Remarks

The Check method returns True or False and also posts a message to the test log - the message shows comparison results. The method also logs every difference found during the comparison. These differences are displayed in the Details panel.

By default, if the Check method cannot find or access the object to be compared, or the object does not match its baseline copy, the method will wait for the object to become accessible and for the comparison to complete successfully for the period the Auto-wait timeout setting specifies. (Go to Tools > Current Project Properties > Playback to view or modify the setting.) If the method fails to access the object, or if the object does not match its baseline copy within this period, the comparison will fail.

To compare the values of the Table element with the data stored in the database or update the data stored in the Table element, you can also use the Compare method of the Table object.

Example

The following example demonstrates how to check whether the data of an object displaying information in the tabular form has been changed and differs from the data stored in the Table element.

JavaScript, JScript

function Test()
{

  var Table;
  // Obtains the Table object
  Table = Tables.OrdersTable;
  // Checks whether the data has been changed
  if (Table.Check())
    Log.Message("The data has not been changed")
  else
    Log.Warning("The data has been changed");

}

Python

def Test():
  # Obtains the Table object
  # Checks whether the data has been changed 
  if Tables.OrdersTable.Check():
    Log.Message("The data has not been changed")
  else:
    Log.Warning("The data has been changed")

VBScript

Sub Test

  Dim Table
  ' Obtains the Table object
  Set Table = Tables.OrdersTable
  ' Checks whether the data has been changed
  If Table.Check Then
    Log.Message("The data has not been changed")
  Else
    Log.Warning("The data has been changed")
  End If

End Sub

DelphiScript

procedure Test();
var Table;
begin

  // Obtains the Table object
  Table := Tables.OrdersTable;
  // Checks whether the data has been changed
  if Table.Check then
    Log.Message('The data has not been changed')
  else
    Log.Warning('The data has been changed');

end;

C++Script, C#Script

function Test()
{

  var Table;
  // Obtains the Table object
  Table = Tables["OrdersTable"];
  // Checks whether the data has been changed
  if (Table["Check"]())
    Log["Message"]("The data has not been changed")
  else
    Log["Warning"]("The data has been changed");

}

See Also

About Table Checkpoints
Compare Method
ObjectName Property

Highlight search results