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 purpose of the ArrayType
object is to let you create and modify array properties in classes. When you create objects based on a class, the array in the class serves as a base for the arrays in the objects. For instance, if you add an array property to a class and then add ten elements to the array, all the objects that are based on this class will have an array property with ten items in the array.
To create a new ArrayType
object in scripts, use the Classes.NewArray
or Class.AddPropOfArrayType
method.
Members
Example
The code below adds a new MyProperty property of the array type to the specified class and then adds three new items to the created property.
JavaScript, JScript
function ArrayTypeExample()
{
// Creates a new class
var Obj = ODT.Classes.Declare("MyClass");
// Adds a new property of the array type to the class
var Prop = Obj.AddPropOfArrayType("MyProperty");
// Adds three items to the MyProperty property
Prop.AddItem(159);
Prop.AddItem("Hello, world.");
var ArrItem = Prop.AddItemOfArrayType;
// ...
}
VBScript
Sub ArrayTypeExample
' Creates a new class
Set Obj = ODT.Classes.Declare("MyClass")
' Adds a new property of the array type to the class
Set Prop = Obj.AddPropOfArrayType("MyProperty")
' Adds three items to the MyProperty property
Prop.AddItem(159)
Prop.AddItem("Hello, world.")
Set ArrItem = Prop.AddItemOfArrayType
' ...
End Sub
DelphiScript
function ArrayTypeExample;
var Obj, Prop, ArrItem;
begin
// Creates a new class
Obj := ODT.Classes.Declare('MyClass');
// Adds a new property of the array type to the class
Prop := Obj.AddPropOfArrayType('MyProperty');
// Adds three items to the MyProperty property
Prop.AddItem(159);
Prop.AddItem('Hello, world.');
ArrItem := Prop.AddItemOfArrayType;
// ...
end;
C++Script, C#Script
function ArrayTypeExample()
{
// Creates a new class
var Obj = ODT["Classes"]["Declare"]("MyClass");
// Adds a new property of the array type to the class
var Prop = Obj["AddPropOfArrayType"]("MyProperty");
// Adds three items to the MyProperty property
Prop["AddItem"](159);
Prop["AddItem"]("Hello, world.");
var ArrItem = Prop["AddItemOfArrayType"];
// ...
}