NetworkSuite.Jobs Property

Applies to TestComplete 15.0, last modified on November 17, 2021
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 Jobs property returns the job collection specified in the network suite that belongs to the current project.

Declaration

NetworkSuite.Hosts

Read-Only Property The Jobs object

Applies To

The property is applied to the following object:

Property Value

The Jobs object that represents the collection of jobs defined in the network suite of the current project.

Example

The following code snippet obtains the collection of jobs, iterates through them, posts information on each job to the test log and verifies whether the network suite can run a job.

JavaScript, JScript

function NetworkSuiteSample()
{
  var Jobs, Job;
  // Obtains the collection of jobs
  Jobs = NetworkSuite.Jobs;

  // Iterates through the jobs in the collection
  for (var i = 0; i < Jobs.Count; i++)
  {
    // Obtains the current job
    Job = Jobs.Items(i);
    Log.AppendFolder(Job.Name);
    Log.Message("Is active: " + Job.Active);
    Log.Message("Task number: " + Job.Tasks.Count);
    // Checks whether the job can be run by the network suite
    if (Job.Verify())
      Log.Message("The job verification has passed successfully")
    else
      Log.Warning("The job verification has failed");
    Log.PopLogFolder();
  }

}

Python

def NetworkSuiteSample():
  # Obtains the collection of jobs
  Jobs = NetworkSuite.Jobs
  # Iterates through the jobs in the collection
  for i in range(0, Jobs.Count):
    # Obtains the current job
    Job = Jobs.Items[i]
    Log.AppendFolder(Job.Name)
    Log.Message("Is active: " + str(Job.Active))
    Log.Message("Task number: " + str(Job.Tasks.Count))
    # Checks whether the job can be run by the network suite
    if Job.Verify():
      Log.Message("The job verification has passed successfully")
    else: 
      Log.Warning("The job verification has failed")
    Log.PopLogFolder()

VBScript

Sub NetworkSuiteSample

  ' Obtains the collection of jobs
  Set Jobs = NetworkSuite.Jobs

  ' Iterates through the jobs in the collection
  For i = 0 To Jobs.Count - 1
    ' Obtains the current job
    Set Job = Jobs.Items(i)
    Log.AppendFolder Job.Name
    Log.Message "Is active: " & Job.Active
    Log.Message "Task number: " & Job.Tasks.Count
    ' Checks whether the job can be run by the network suite
    If Job.Verify Then
      Log.Message "The job verification has passed successfully"
    Else
      Log.Warning "The job verification has failed"
    End If
    Log.PopLogFolder
  Next

End Sub

DelphiScript

procedure NetworkSuiteSample();
var Jobs, i, Job;
begin
  // Obtains the collection of jobs
  Jobs := NetworkSuite.Jobs;

  // Iterates through the jobs in the collection
  for i := 0 to Jobs.Count - 1 do
  begin
    // Obtains the current job
    Job := Jobs.Items[i];
    Log.AppendFolder(Job.Name);
    Log.Message('Is active: ' + aqConvert.VarToStr(Job.Active));
    Log.Message('Task number: ' + aqConvert.IntToStr(Job.Tasks.Count));
    // Checks whether the job can be run by the network suite
    if Job.Verify then
      Log.Message('The job verification has passed successfully')
    else
      Log.Warning('The job verification has failed');
    Log.PopLogFolder;
  end;

end;

C++Script, C#Script

function NetworkSuiteSample()
{
  var Jobs, Job;
  // Obtains the collection of jobs
  Jobs = NetworkSuite["Jobs"];

  // Iterates through the jobs in the collection
  for (var i = 0; i < Jobs["Count"]; i++)
  {
    // Obtains the current job
    Job = Jobs["Items"](i);
    Log["AppendFolder"](Job["Name"]);
    Log["Message"]("Is active: " + Job["Active"]);
    Log["Message"]("Task number: " + Job["Tasks"]["Count"]);
    // Checks whether the job can be run by the network suite
    if (Job["Verify"]())
      Log["Message"]("The job verification has passed successfully")
    else
      Log["Warning"]("The job verification has failed");
    Log["PopLogFolder"]();
  }

}

See Also

Distributed Testing
Working With Jobs
Jobs Object
NetworkSuite.Hosts
NetworkSuite.Variables

Highlight search results