Parameterizing Region Checkpoints

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

In TestComplete, region checkpoints verify that an object of the application under test or an arbitrary area inside an object is displayed correctly. This is done by comparing the actual image of the object or area with the baseline image stored in your test project.

Region checkpoints take parameters that specify the actual image to be verified and comparison settings (for example, pixel and color tolerance, comparison mask and so on). For detailed information on region checkpoint parameters, see the description of the Region Checkpoint keyword test operation or the description of the Regions.RegionCheckpointName.Check scripting method. The name of the baseline image used by the region checkpoint is specified by the checkpoint name.

In your tests you may want to parameterize your region checkpoints, that is, to replace their hard-coded values with variable values.

For example, if you want your region checkpoint to use various comparison settings during each test run, you can replace its hard-coded comparison parameters’ values with variable values you specify before you call the checkpoint. You can also replace the hard-coded name of the image that the checkpoint verifies with the parameter and then re-use the checkpoint in your tests to check multiple onscreen objects against the same baseline image.

This topic provides information on how to parameterize your region checkpoints:

In Keyword Tests

To parameterize your region checkpoints in keyword tests, in the Operation Parameters dialog of the Region Checkpoint operation replace the operation’s hard-coded values with keyword test parameters or with keyword test, project or project suite variables containing desired data.

The image below demonstrates two region checkpoints. One of them verifies the image of the object using the hard-coded name of the onscreen object to verify and the hard-coded values of comparison parameters, the other one uses the object’s name and values of comparison parameters stored in the keyword test parameters:

Parameterized Region Checkpoint operation

In Scripts

To parameterize your region checkpoints in script tests, replace the hard-coded values passed to the Regions.RegionCheckpointName.Check method with script routine parameters or with script, project or project suite variables.

The following code example demonstrates two property checkpoints. One of them verifies the image of the object using the hard-coded name of the object to verify and the hard-coded values of comparison parameters, the other one uses the object’s name and comparison parameters’ values passed via script routine parameters:

JavaScript, JScript

function Test(onscreenObj,transparentParam, mouseParam, pixelTolParam, colorTolParam, maskParam)
{

  …

  Regions.wndNotepad.Check(Aliases.notepad.wndNotepad, false, false, 0, 0, "wndNotepad_Mask");

  …

  Regions.wndNotepad.Check(onscreenObj, transparentParam, mouseParam, pixelTolParam, colorTolParam, maskParam);

  …

}

Python

def Test(onscreenObj,transparentParam, mouseParam, pixelTolParam, colorTolParam, maskParam):

  ...

  Regions.wndNotepad.Check(Aliases.notepad.wndNotepad, False, False, 0, 0, "wndNotepad_Mask")

  ...

  Regions.wndNotepad.Check(onscreenObj, transparentParam, mouseParam, pixelTolParam, colorTolParam, maskParam)

  ...

VBScript

Sub Test(onscreenObj, transparentParam, mouseParam, pixelTolParam, colorTolParam, maskParam)

  …

  Call Regions.wndNotepad.Check(Aliases.notepad.wndNotepad, false, false, 0, 0, "wndNotepad_Mask")

  …

  Call Regions.wndNotepad.Check(onscreenObj, transparentParam, mouseParam, pixelTolParam, colorTolParam, maskParam)

  …

End Sub

DelphiScript

procedure Test(onscreenObj, transparentParam, mouseParam, pixelTolParam, colorTolParam, maskParam);
begin

  …

  Regions.wndNotepad.Check(Aliases.notepad.wndNotepad, false, false, 0, 0, 'wndNotepad_Mask');

  …

  Regions.wndNotepad.Check(onscreenObj, transparentParam, mouseParam, pixelTolParam, colorTolParam, maskParam);

  …

end;

C++Script, C#Script

function Test(onscreenObj, transparentParam, mouseParam, pixelTolParam, colorTolParam, maskParam)
{

  …

  Regions["wndNotepad"]["Check"](Aliases.notepad.wndNotepad, false, false, 0, 0, "wndNotepad_Mask");

  …

  Regions["wndNotepad"]["Check"](onscreenObj, transparentParam, mouseParam, pixelTolParam, colorTolParam, maskParam);

  …

}

See Also

Region Checkpoints
About Region Checkpoints
Parameterizing Keyword Tests
Parameterizing Script Routines

Highlight search results