Tasks Property

Applies to TestComplete 15.63, last modified on April 23, 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 Tasks property returns the collection of tasks defined in the given job.

Declaration

JobObj.Tasks

Read-Only Property A Tasks object
JobObj An expression, variable or parameter that specifies a reference to a Job object

Applies To

The property is applied to the following object:

Property Value

A Tasks object that represents the job’s task collection.

Example

The following code obtains a job by its name, then obtains one of the job's tasks by the name and runs the task at the end of the test.

JavaScript, JScript

function TasksExample()

{
  // Specifies the name of a job
  var jName = "Job_Name";
  // Specifies the name of the desired task
  var tName = "Task_Name";
  // Obtains the tasks that belong to the specified job
  var Tasks = NetworkSuite.Jobs.ItemByName(jName).Tasks;
  // Obtains the desired task by its name
  var Task = Tasks.ItemByName(tName);
  // Runs the task  Task.Run(true);

}

Python

def TasksExample():
  # Specifies the name of a job
  jName = "Job_Name"
  # Specifies the name of the desired task
  tName = "Task_Name"
  # Obtains the tasks that belong to the specified job
  Tasks = NetworkSuite.Jobs.ItemByName[jName].Tasks;
  # Obtains the desired task by its name
  Task = Tasks.ItemByName[tName]
  Task.Run(True) # Runs the task

VBScript

Sub TasksExample()

  ' Specifies the name of a job
  jName = "Job_Name"
  ' Specifies the name of the desired task
  tName = "Task_Name"
  ' Obtains the tasks that belong to the specified job
  Set Tasks = NetworkSuite.Jobs.ItemByName(jName).Tasks
  ' Obtains the desired task by its name
  Set Task = Tasks.ItemByName(tName)
  ' Runs the task  Task.Run(True)

End Sub

DelphiScript

function TasksExample;

var jName, tName, Tasks, Task;
begin

  // Specifies the name of a job
  jName := 'Job_Name';
  // Specifies the name of the desired task
  tName := 'Task_Name';
  // Obtains the tasks that belong to the specified job
  Tasks := NetworkSuite.Jobs.ItemByName[jName].Tasks;
  // Obtains the desired task by its name
  Task := Tasks.ItemByName[tName];
  // Runs the task  Task.Run(true);


end;

C++Script, C#Script

function TasksExample()

{
  // Specifies the name of a job
  var jName = "Job_Name";
  // Specifies the name of the desired task
  var tName = "Task_Name";
  // Obtains the tasks that belong to the specified job
  var Tasks = NetworkSuite["Jobs"]["ItemByName"](jName)["Tasks"];
  // Obtains the desired task by its name
  var Task = Tasks["ItemByName"](tName);
  // Runs the task  Task["Run"](true);

}

See Also

Distributed Testing
Tasks Object

Highlight search results