Count Property

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

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

Use the PropValueSet.Count property to get the total number of items in the PropValueSet collection.

Declaration

PropValueSetObj.Count

Read-Only Property Integer
PropValueSetObj An expression, variable or parameter that specifies a reference to a PropValueSet object

Applies To

The property is applied to the following object:

Property Value

The total number of items in the PropValueSet collection.

Example

The following example iterates through the elements of the PropValueSet collection, posts values stored in the collection to the test log informing whether the values will be processed by the Run method.

JavaScript, JScript

function PropValueSetSample()
{
  // Obtains the specified class
  var MyClassObj = ODT.Classes.MyClass;
  // Obtains the PropValueSet collection
  var PropValueSetObj = MyClassObj.PropValueSet("MyProperty");
  // Determines the total number of items in the collection
  var Count = PropValueSetObj.Count;

  // Iterates through the collection
  for (var i = 0; i < Count; i++)
  {
    // Posts a value to the test log and informs whether the value will be processed
    var Value = PropValueSetObj.Values(i);
    if (PropValueSetObj.Checked(i))
      Log.Message(Value + ": Enabled")
    else
      Log.Message(Value + ": Disabled");
  }
}

VBScript

Sub PropValueSetSample

  ' Obtains the specified class
  Set MyClassObj = ODT.Classes.MyClass
  ' Obtains the PropValueSet collection
  Set PropValueSetObj = MyClassObj.PropValueSet("MyProperty")
  ' Determines the total number of items in the collection
  Count = PropValueSetObj.Count

  ' Iterates through the collection
  For i = 0 To Count - 1
    ' Posts a value to the test log and informs whether the value will be processed
    Value = PropValueSetObj.Values(i)
    If PropValueSetObj.Checked(i) Then
      Log.Message(Value & ": Enabled")
    Else
      Log.Message(Value & ": Disabled")
    End If
  Next
End Sub

DelphiScript

procedure PropValueSetSample();
var MyClassObj, PropValueSetObj, Count, Value, i;
begin
  // Obtains the specified class
  MyClassObj := ODT.Classes.MyClass;
  // Obtains the PropValueSet collection
  PropValueSetObj := MyClassObj.PropValueSet['MyProperty'];
  // Determines the total number of items in the collection
  Count := PropValueSetObj.Count;

  // Iterates through the collection
  for i := 0 to Count - 1 do
  begin
    // Posts a value to the test log and informs whether the value will be processed
    Value := PropValueSetObj.Values[i];
    if PropValueSetObj.Checked[i] then
      Log.Message(Value + ': Enabled')
    else
      Log.Message(Value + ': Disabled');
  end;
end;

C++Script, C#Script

function PropValueSetSample()
{
  // Obtains the specified class
  var MyClassObj = ODT["Classes"]["MyClass"];
  // Obtains the PropValueSet collection
  var PropValueSetObj = MyClassObj["PropValueSet"]("MyProperty");
  // Determines the total number of items in the collection
  var Count = PropValueSetObj["Count"];

  // Iterates through the collection
  for (var i = 0; i < Count; i++)
  {
    // Posts a value to the test log and informs whether the value will be processed
    var Value = PropValueSetObj["Values"](i);
    if (PropValueSetObj["Checked"](i))
      Log["Message"](Value + ": Enabled")
    else
      Log["Message"](Value + ": Disabled");
  }
}

See Also

ValueIndex Property
Values Property
Checked Property

Highlight search results