Check Method

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

Use the Check method to compare the values stored in the DBTable project element corresponding to the DBTableObj object with the values stored in the database which is specified by the element’s properties.

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

Declaration

DBTableObj.Check()

DBTableObj An expression, variable or parameter that specifies a reference to a DBTable object
Result Boolean

Applies To

The method is applied to the following object:

Result Value

In the comparison mode, if the database 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 the 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 Tools > Current Project Properties > Playback > Auto-wait timeout setting specifies. 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 DBTable element with the data stored in the database or update the data stored in the DBTable element, you can also use the Compare method of the DBTable object.

Example

The code below performs some actions with the data stored in the specified DB Table element and then checks whether the data has been changed.

JavaScript, JScript

function CompareDBTables()
{
  // Specifies a DB Table element
  var DBTab = DBTables.Table1;
  
  // Performs some action with the stored data
 
  // Checks whether the data has been changed
  if (DBTab.Check())
    Log.Message("The data hasn't been changed.");

}

Python

def CompareDBTables():
  # Specifies a DB Table element
  DBTab = DBTables.Table1
  # Performs some action with the stored data
  # Checks whether the data has been changed
  if DBTab.Check():
    Log.Message("The data hasn't been changed.")

VBScript

Sub CompareDBTables
  
  ' Specifies a DB Table element
  Set DBTab = DBTables.Table1
  
  ' Performs some action with the stored data
 
  ' Checks whether the data has been changed
  If DBTab.Check Then
    Log.Message("The data hasn't been changed.")
  End If
   
End Sub

DelphiScript

function CompareDBTables();
var DBTab, Res;
begin

  // Specifies a DB Table element
  DBTab := DBTables.Table1;
  
  // Performs some action with the stored data
 
  // Checks whether the data has been changed
  if DBTab.Check then
    Log.Message('The data hasn''t been changed.');

end;

C++Script, C#Script

function CompareDBTables()
{
  // Specifies a DB Table element
  var DBTab = DBTables["Table1"];
  
  // Performs some action with the stored data
 
  // Checks whether the data has been changed
  if (DBTab["Check"]())
    Log["Message"]("The data hasn't been changed.");

}

See Also

About Database Checkpoints
Compare Method

Highlight search results