Task Object

Applies to TestComplete 14.73, last modified on February 25, 2021

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