Property Object

Applies to TestComplete 14.40, 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.

Description

The Property objects provide a scripting interface to properties of objects that were created via the ODT project item.

The Property object properties as the PropertyDeclaration object plus additional Enabled property that specifies whether the property is processed by ODT Run methods. To obtain the Property object in scripts, use the Properties property or AddProperty method of the Object object.

Members

Example

The following example demonstrates how to use the Properties property of the Object object to get access to the object’s properties. To obtain the object whose properties we want to access, we use the Value property of the Variable object that holds the reference to the needed object.

JavaScript, JScript

function PropertySample()
{

  var PropertyObj, Variable, VObj;
  // Obtains the variable that holds the reference to an object
  Variable = ODT.Data.Groups("Data").Variables("SampleVar");
  // Obtains the object
  VObj = Variable.Value;
  // Obtains the Property object
  PropertyObj = VObj.Properties(0);
  …

}

VBScript

Sub PropertySample

  Dim PropertyObj, Variable, VObj
  ' Obtains the variable that holds the reference to an object
  Set Variable = ODT.Data.Groups("Data").Variables("SampleVar")
  ' Obtains the object
  Set VObj = Variable.Value
  ' Obtains the Property object
  Set PropertyObj = VObj.Properties(0)
  …

End Sub

DelphiScript

procedure PropertySample();
var PropertyObj, Variable, VObj;
begin

  // Obtains the variable that holds the reference to an object
  Variable := ODT.Data.Groups['Data'].Variables['SampleVar'];
  // Obtains the object
  VObj := Variable.Value;
  // Obtains the Property object
  PropertyObj := VObj.Properties[0];
  …

end;

C++Script, C#Script

function PropertySample()
{

  var PropertyObj, Variable, VObj;
  // Obtains the variable that holds the reference to an object
  Variable = ODT["Data"]["Groups"]("Data")["Variables"]("SampleVar");
  // Obtains the object
  VObj = Variable["Value"];
  // Obtains the Property object
  PropertyObj = VObj["Properties"](0);
  …

}

See Also

PropertyDeclaration Object
Object Object
AddProperty Method
Properties Property
Method Object

Highlight search results