Parameterizing Property Checkpoints

Applies to TestComplete 15.70, last modified on December 17, 2024

In TestComplete, property checkpoints obtain the actual value of the tested object existing in your application and verify that the value meets the specified conditions. Property checkpoints you create via the Create Checkpoint wizard or Quick Checkpoints use hard-coded values for verification. In other words, these checkpoints will always perform the same verification procedure checking the same object property against the same baseline value.

If a property value you want to verify in your test changes between test runs you may want to replace the checkpoint’s hard-coded baseline value with a parameter that obtains the desired value before each test run. That is, you may want to parameterize your property checkpoint.

The image below demonstrates two Property Checkpoint operations. One of them checks the tested object’s property against the hard-coded string value, the other one — against the value stored in keyword test parameter Param1.

Parameterizing the Property Checkpoint operation

Click the image to enlarge it.

The sections below describe how to parameterize your property checkpoints:

In keyword tests

  1. Create a parameter that will pass the needed value to the checkpoint. It can be:

    For example, the image below shows the Param1 parameter of a keyword test:

    Creating a keyword test parameter to parameterize a checkpoint

    Click the image to enlarge it.

  2. In your keyword test, replace the hard-coded value of the checkpoint operation with the created parameter or variable:

    Parameterizing Checkpoint operation

    Click the image to enlarge it.

  3. Assign the needed value to the created parameter or variable:

    • If you use a test parameter, set its value when you run your test:

      • If you run it as part of the project’s test items sequence, set the test parameter in the Execution Plan editor of your project:

        Setting parameter value

        Click the image to enlarge it.

      • If you run your test from another test, set the parameter value when calling your test.

    • To set a variable value, you can use the Set Variable Value operation.

  4. Run the test with the needed parameter value assigned.

In scripts

  1. Define a parameter or variable that will pass the needed value to the checkpoint. It can be:

    For example, the code snippet below shows how to declare the Param1 parameter of a script routine:

    JavaScript, JScript

    function ValidateProperty(Param1)
    {
      …
      …
    }

    Python

    def ValidateProperty(Param1):
      …

    VBScript

    Sub ValidateProperty(Param1)
      …
    End Sub

    DelphiScript

    procedure ValidateProperty(Param1);
    begin
      …
    end;

    C++Script, C#Script

    function ValidateProperty(Param1)
    {
      …
    }
  2. Replace the hard-coded parameter of the aqObject.CheckProperty method with the created variable or parameter:

    JavaScript, JScript

    function ValidateProperty(Param1)
    {
      …
      // Validate the object property
      aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, "wText", cmpEqual, Param1);
      …
    }

    Python

    def ValidateProperty(Param1):
      …
      # Validate the object property
      aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, "wText", cmpEqual, Param1)
      …

    VBScript

    Sub ValidateProperty(Param1)
      …
      ' Validate the object property
      Call aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, "wText", cmpEqual, Param1)
      …
    End Sub

    DelphiScript

    procedure ValidateProperty(Param1);
    begin
      …
      // Validate the object property
      aqObject.CheckProperty(Aliases.SampleApp.MainForm.Edit, 'wText', cmpEqual, Param1);
      …
    end;

    C++Script, C#Script

    function ValidateProperty(Param1)
    {
      …
      // Validate the object property
      aqObject["CheckProperty"](Aliases["SampleApp"]["MainForm"]["Edit"], "wText", cmpEqual, Param1);
      …
    }
  3. Assign the needed value to the parameter or variable:

    • If you use a script parameter, you set the parameter value when you call the script, either from another script routine or as the project’s test item.

      The image below shows how to set the parameter value when running the script routine as a project’s test item:

      Setting parameter value

      Click the image to enlarge it.

    • If you use a variable, set its value in the script before the script executes the checkpoint.

  4. Run the script with the needed parameter value assigned.

Obtain parameters from external files

The parameters you pass to property checkpoints in tests can contain data from external storages, for example, from databases or text or Excel files. TestComplete provides special features for parameterizing tests with data from external storages. For more information on this, see Parameterizing Tests Using External Data Sources.

See Also

Property Checkpoints
About Property Checkpoints
Using Variables
Parameterizing Tests
Parameterizing Tests Using External Data Sources

Highlight search results