Jobs Object

Applies to TestComplete 14.0, last modified on January 23, 2019

Description

The Jobs object represents a collection of jobs specified in the network suite of the current project (See Editing Job Properties). Each job is represented by a Job object.

To get the Jobs object, use the NetworkSuite.Jobs property.

Members

Example

The code below obtains a collection of jobs that belong to a network suite and then posts the name of each job 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
Working With Jobs
NetworkSuite.Jobs Property
Job Object

Highlight search results