Alternatives to Object Checkpoints

Applies to TestComplete 15.47, last modified on January 20, 2023
Object checkpoints are deprecated. We do not recommend using them. Use property checkpoints instead.

If in your test you need to verify a collection of object properties, but you cannot use an object checkpoint for some reason, you can take one of the following alternative approaches:

Create a Custom Verification Procedure

In a test, to check object properties, perform the following steps:

  • Obtain the desired object.

  • Obtain values of the object’s properties.

  • Compare the property values with expected values. Note that to compare actual values with expected values, you can use various comparison operations, like =, <, > and so on. You can also use property checkpoints to check an object’s properties.

  • Report the results.

However, this approach requires a lot of comparison operations.

Use the Objects.Compare Method for Property Verification

In script tests, to verify a collection of object properties, use the Objects.Compare method. It allows comparing the actual values of an object’s properties with a collection of expected values stored in the project’s Stores | Objects collection. To call the method in keyword tests, you can use the Call Object Method, Run Code Snippet or Run Script Routine operations.

The Objects.Compare method is similar to the object checkpoint, but it posts less detailed verification results to the test log. However, the method allows you to specify what kind of message (an error, warning, informative message or no message at all) will be posted to the log if the comparison fails.

The following code snippet demonstrates how to use the method:

JavaScript, JScript

function Test()
{

  var wnd = Sys.Process("TestedApp").Window("Main");

  // Compares actual property values with values stored in the Stores | Objects | Props collection
  // And posts an error if the comparison fails
  Objects.Compare(wnd, "Props", true, lmError);

}

Python

def Test():
  wnd = Sys.Process("TestedApp").Window("Main")

  # Compares actual property values with values stored in the Stores | Objects | Props collection
  # And posts an error if the comparison fails
  Objects.Compare(wnd, "Props", True, lmError)

VBScript

Sub Test

  Set wnd = Sys.Process("TestedApp").Window("Main")

  ' Compares actual property values with values stored in the Stores | Objects | Props collection
  ' And posts an error if the comparison fails
  Call Objects.Compare(wnd, "Props", true, lmError)

End Sub

DelphiScript

procedure Test();
var wnd;
begin

  wnd := Sys.Process('TestedApp').Window('Main');

  // Compares actual property values with values stored in the Stores | Objects | Props collection
  // And posts an error if the comparison fails
  Objects.Compare(wnd, 'Props', true, lmError);

end;

C++Script, C#Script

function Test()
{

  var wnd = Sys["Process"]("TestedApp")["Window"]("Main");

  // Compares actual property values with values stored in the Stores | Objects | Props collection
  // And posts an error if the comparison fails
  Objects["Compare"](wnd, "Props", true, lmError);

}

Similar to object checkpoints, the Objects.Compare method allows you to update stored expected values. If both the Update objects option in the Stores settings and the Update option of the stored property collection are enabled, the Objects.Compare method will update the whole property collection with the actual property values of the tested object instead of comparing them.

See Also

Object Checkpoints
About Object Checkpoints
About Objects Collection
Object Checkpoint Operation
Check Method
Compare Method
About Property Checkpoints

Highlight search results