Task Object

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 Task object represents one of the tasks specified in the particular job of the given network suite (see Editing Task Properties). You obtain a task as an item in the task collection (see Tasks Object).

Members

Example

The following script runs all tasks (except for the last one) belonging to the network suite's first job.

JavaScript, JScript

function Test()
{
  var Tasks = NetworkSuite.Jobs(0).Tasks;
  for (var i = 0; i < Tasks.Count - 1; i++)
    Tasks.Items(i).Run(true);
}

Python

def Test():
  Tasks = NetworkSuite.Jobs.Items[0].Tasks
  for i in range (0, Tasks.Count - 1):
    Tasks.Items[i].Run(True)

VBScript

Sub Test
  Set Tasks = NetworkSuite.Jobs(0).Tasks
  For i = 0 To Tasks.Count - 2
    Tasks.Items(i).Run(True)
  Next
End Sub

DelphiScript

procedure Test;
var Tasks, i : OleVariant;
begin
  Tasks := NetworkSuite.Jobs[0].Tasks;
  for i := 0 to Tasks.Count - 2 do
   Tasks.Items[i].Run(True);
end;

C++Script, C#Script

function Test()
{
  var Tasks = NetworkSuite["Jobs"](0)["Tasks"];
  for (var i = 0; i < Tasks["Count"] - 1; i++)
    Tasks["Items"](i)["Run"](true);
}

See Also

Distributed Testing
Editing Task Properties
Tasks Object
Items Property
ItemByName Property

Highlight search results