Count Property

Applies to TestComplete 15.69, last modified on November 13, 2024
The Network Suite functionality is deprecated. We don’t recommend using it for distributed testing. Consider using a CI/CD system for managing distributed tests. See Migrating Distributed Tests to CI/CD Systems for details. In case you need to run web tests on multiple environments in parallel, you can also try using your project’s Execution Plan.

Description

The Count property returns the number of jobs in the job collection represented by the Jobs object.

Declaration

JobsObj.Count

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

Applies To

The property is applied to the following object:

Property Value

An integer value that means the number of jobs in the job collection.

Example

The code below obtains the total number of jobs that belong to a network suite and then posts the names of all the jobs to the test log.

JavaScript, JScript

function JobsNamesExample()
{
  // Obtains information about the jobs
  var Jobs = NetworkSuite.Jobs;
  // Obtains the number of the jobs that belong to the network suite
  var Num = Jobs.Count;
  
  // Iterates through the jobs
  for (var i = 0; i < Num; i++)
  {
    // Obtains the current job
    var Job = Jobs.Items(i);
    var Name = Job.Name;
    // Posts the job's name to the test log
    Log.Message(Name);
  }
}

Python

def JobsNamesExample():
  # Obtains information about the jobs
  Jobs = NetworkSuite.Jobs
  # Obtains the number of the jobs that belong to the network suite
  Num = Jobs.Count
  # Iterates through the jobs
  for i in range(0, Num):
    # Obtains the current job
    Job = Jobs.Items[i]
    Name = Job.Name
    # Posts the job's name to the test log
    Log.Message(Name)

VBScript

Sub JobsNamesExample()

  ' Obtains information about the jobs
  Set Jobs = NetworkSuite.Jobs
  ' Obtains the number of the jobs that belong to the network suite
  Num = Jobs.Count
  
  ' Iterates through the jobs
  For i = 0 to (Num - 1)
    ' Obtains the current job
    Set Job = Jobs.Items(i)
    Name = Job.Name
    ' Posts the job's name to the test log
    Log.Message(Name)
  Next
  
End Sub

DelphiScript

function JobsNamesExample;
var Jobs, Num, i, Job, Name;
begin

  // Obtains information about the jobs
  Jobs := NetworkSuite.Jobs;
  // Obtains the number of the jobs that belong to the network suite
  Num := Jobs.Count;
  
  // Iterates through the jobs
  for i := 0 to (Num - 1) do
  begin
    // Obtains the current job
    Job := Jobs.Items[i];
    Name := Job.Name;
    // Posts the job's name to the test log
    Log.Message(Name);
  end;

end;

C++Script, C#Script

function JobsNamesExample()
{
  // Obtains information about the jobs
  var Jobs = NetworkSuite["Jobs"];
  // Obtains the number of the jobs that belong to the network suite
  var Num = Jobs["Count"];
  
  // Iterates through the jobs
  for (var i = 0; i < Num; i++)
  {
    // Obtains the current job
    var Job = Jobs["Items"](i);
    var Name = Job["Name"];
    // Posts the job's name to the test log
    Log["Message"](Name);
  }
}

See Also

Distributed Testing
Items Property
ItemByName Property

Highlight search results