Filtering Custom Objects Programmatically

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

The object-driven testing (ODT) functionality is deprecated. Do not use it to create new tests. It will be removed from the product in one of the future releases. As an alternative, you can create custom classes in your scripts. For more information, see Alternatives to the ODT functionality.

The ODT project item includes specific means for walking down the custom object hierarchy and processing elements at each level. For more information on this, see Controlling Object-Driven Tests. The project item includes certain means for specifying what objects should participate in testing. One of these means is filtering. It lets you easily include or exclude objects from processing during the walk. You can filter objects both visually (via the ODT editor) and programmatically.

The following script routine below illustrates the program approach to filtering. It excludes objects, whose Caption property holds the string abracadabra. MyClassObj holds a reference to a custom class created via the ODT project item:

JavaScript

PropValueSetObj = MyClassObj.PropValueSet("Caption");
idx = PropValueSetObj.ValueIndex("abracadabra");
PropValueSetObj.$set("Checked", idx, false);

JScript

PropValueSetObj = MyClassObj.PropValueSet("Caption");
idx = PropValueSetObj.ValueIndex("abracadabra");
PropValueSetObj.Checked(idx) = false;

VBScript

Set PropValueSetObj = MyClassObj.PropValueSet("Caption")
idx = PropValueSetObj.ValueIndex("abracadabra")
PropValueSetObj.Checked(idx) = False

DelphiScript

var
  PropValueSetObj, idx, MyClassObj : OleVariant;
...
PropValueSetObj := MyClassObj.PropValueSet["Caption"];
idx := PropValueSetObj.ValueIndex["abracadabra"];
PropValueSetObj.Checked[idx] = False;

C++Script, C#Script

var PropValueSetObj, idx, MyClassObj;
...
PropValueSetObj = MyClassObj["PropValueSet"]("Caption");
idx = PropValueSetObj["ValueIndex"]("abracadabra");
PropValueSetObj["Checked"](idx) = False

See Also

Controlling Object-Driven Tests

Highlight search results