ManualCheck.Compare Method

Applies to TestComplete 14.70, last modified on April 22, 2021

Description

Use the Compare method to implement manual checkpoints in your scripts. The method displays the Manual Checkpoint dialog and returns True or False according to which button the user pressed to close the dialog.

Declaration

ManualCheck.Compare(CheckpointName)

CheckpointName [in]    Required    String    
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

CheckpointName

Specifies the element of the Stores | Files collection (that is, the file) that contains the text to be displayed in the Manual Checkpoint dialog.

Result Value

True, if the user pressed Success to close the Manual Checkpoint dialog, otherwise it returns False.

Example

The following example demonstrates how to call the Manual Checkpoint dialog in your scripts.

JavaScript, JScript

function Test()
{
  ...

  // Specifies the manual checkpoint name
  var Name = "MyCheckpoint";

  // Checks whether the Files collection contains the specified checkpoint
  if (Files.Contains(Name))
  {
    // Displays the Manual Checkpoint dialog
    if (ManualCheck.Compare(Name))
      Log.Message("The \"" + Name + "\" manual checkpoint has passed successfully");
    else
      Log.Error("The \"" + Name + "\" manual checkpoint has failed");
  }
  else
    Log.Warning("The \"" + Name + "\" manual checkpoint was not found");
  ...

}

Python

def Test():
  # ...
  # Specifies the manual checkpoint name 
  Name = "MyCheckpoint"
  # Checks whether the Files collection contains the specified checkpoint 
  if Files.Contains(Name):
    # Displays the Manual Checkpoint dialog 
    if ManualCheck.Compare(Name):
      Log.Message("The " + Name + " manual checkpoint has passed successfully")
    else: 
       Log.Error("The " + Name + "\" manual checkpoint has failed")
  else: 
     Log.Warning("The \"" + Name + "\" manual checkpoint was not found")
  # ...

VBScript

Sub Test

  ...

  ' Specifies the manual checkpoint name
  Name = "MyCheckpoint"

  ' Checks whether the Files collection contains the specified checkpoint
  If Files.Contains(Name) Then
    ' Displays the Manual Checkpoint dialog
    If ManualCheck.Compare(Name) Then
      Log.Message "The """ & Name & """ manual checkpoint has passed successfully"
    Else
      Log.Error "The """ & Name & """ manual checkpoint has failed"
    End If
  Else
    Log.Warning "The """ & Name & """ manual checkpoint was not found"
  End If

  ...

End Sub

DelphiScript

procedure Test();
var Name;
begin
  ...

  // Specifies the manual checkpoint name
  Name := 'MyCheckpoint';

  // Checks whether the Files collection contains the specified checkpoint
  if Files.Contains(Name) then
  begin
    // Displays the Manual Checkpoint dialog
    if ManualCheck.Compare(Name) then
      Log.Message('The "' + Name + '" manual checkpoint has passed successfully')
    else
      Log.Error('The "' + Name + '" manual checkpoint has failed');
  end
  else
    Log.Warning('The "' + Name + '" manual checkpoint was not found');
  ...

end;

C++Script, C#Script

function Test()
{
  ...

  // Specifies the manual checkpoint name
  var Name = "MyCheckpoint";

  // Checks whether the Files collection contains the specified checkpoint
  if (Files["Contains"](Name))
  {
    // Displays the Manual Checkpoint dialog
    if (ManualCheck["Compare"](Name))
      Log["Message"]("The \"" + Name + "\" manual checkpoint has passed successfully");
    else
      Log["Error"]("The \"" + Name + "\" manual checkpoint has failed");
  }
  else
    Log["Warning"]("The \"" + Name + "\" manual checkpoint was not found");
  ...

}

See Also

About Manual Checkpoints

Highlight search results