PropertyDeclaration Object

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

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 PropertyDeclaration object provides a scripting interface to properties of ODT classes. It represents a “declaration” of a class property and provides properties that let you specify the name and the default value of a class property.

Note that to work with properties of objects that are class instances (that is, Object objects created via the Classes.New method), the Property object is used.

To obtain the PropertyDeclaration in your scripts, use the Properties property of the Class object.

Members

Example

The following example demonstrates how to obtain the PropertyDeclaration object in your script:

JavaScript, JScript

function PropertyDeclarationSample()
{

  var SampleClass, PropDeclObj;
  // Obtains the existing class by its name
  SampleClass = ODT.Classes.Items("SampleClass");
  // Obtains the declaration of the class property
  PropDeclObj = SampleClass.Properties(0);
  …

}

VBScript

Sub PropertyDeclarationSample

  Dim SampleClass, PropDeclObj
  ' Obtains the existing class by its name
  Set SampleClass = ODT.Classes.Items("SampleClass")
  ' Obtains the declaration of the class property
  Set PropDeclObj = SampleClass.Properties(0)
  …

End Sub

DelphiScript

procedure PropertyDeclarationSample();
var SampleClass, PropDeclObj;
begin

  // Obtains the existing class by its name
  SampleClass := ODT.Classes.Items['SampleClass'];
  // Obtains the declaration of the class property
  PropDeclObj := SampleClass.Properties[0];
  …

end;

C++Script, C#Script

function PropertyDeclarationSample()
{

  var SampleClass, PropDeclObj;
  // Obtains the existing class by its name
  SampleClass = ODT["Classes"]["Items"]("SampleClass");
  // Obtains the declaration of the class property
  PropDeclObj = SampleClass["Properties"](0);
  …

}

See Also

Object-Driven Testing
Class Object
Properties Property
MethodDeclaration Object
Property Object

Highlight search results