HostTimeOut Property

Applies to TestComplete 15.47, last modified on January 20, 2023
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 HostTimeOut property specifies the time period (in minutes) the network suite will wait until the host assigned to the given task becomes available (see the Host timeout property of the task).

Declaration

TaskObj.HostTimeOut

Read-Write Property Integer
TaskObj An expression, variable or parameter that specifies a reference to a Task object

Applies To

The property is applied to the following object:

Property Value

An integer value holding the number of minutes to wait for the host. If the TaskObj.HostTimeOut property is set to 0, the network suite does not wait for the host.

Remarks

If the remote host does not respond before the specified timeout period elapses, an error will occur.

Example

The following code snippet obtains the task by its name, specifies the host on which the task will be run and sets the timeout period for which network suite will wait for the host to respond.

JavaScript, JScript

function Test()
{

  var JobName, TaskName, Task;
  // Specifies the name for the job to which the task belongs
  JobName = "MyJob";

  // Specifies the name of the task
  TaskName = "MyTask";

  // Obtains the task by its name
  Task = NetworkSuite.Jobs.ItemByName(JobName).Tasks.ItemByName(TaskName);

  // Specifies the host on which the task will be run
  Task.Host = NetworkSuite.Hosts.ItemByName("SlaveComputer1");

  // Specifies the timeout period for the host
  Task.HostTimeOut = 6;

  // Specifies other task properties
  …

  // Runs the task
  Task.Run(true);

}

Python

def Test():
  # Specifies the name for the task
  TaskName = "MyTask"
  # Obtains the task by its name
  Task = NetworkSuite.Jobs.ItemByName["MyJob"].Tasks.ItemByName[TaskName]
  # Specifies the host on which the task will be run
  Task.Host = NetworkSuite.Hosts.ItemByName["SlaveComputer1"]
  # Specifies the path to the project the task will run
  Task.ProjectPath = "D:\\Distributed Testing\\Slave\\SlaveProject.mds"
  # Specifies the test item the task will run
  Task.Test = "Slave_Script\\Script\\Slave\\Main"
  # Specifies the timeout period for the host
  Task.HostTimeOut = 6
  # Specifies other task properties
  # ...
  # Runs the task
  Task.Run(True)

VBScript

Sub Test

  Dim JobName, TaskName, Task
  ' Specifies the name for the job to which the task belongs
  JobName = "MyJob"
  ' Specifies the name of the task
  TaskName = "MyTask"
  ' Obtains the task by its name
  Set Task = NetworkSuite.Jobs.ItemByName(JobName).Tasks.ItemByName(TaskName)

  ' Specifies the host on which the task will be run
  Set Task.Host = NetworkSuite.Hosts.ItemByName("SlaveComputer1")

  ' Specifies the timeout period for the host
  Task.HostTimeOut = 6

  ' Specifies other task properties
  …

  ' Runs the task
  Task.Run(True)
End Sub

DelphiScript

procedure Test();
var JobName, TaskName, Task;
begin
  // Specifies the name for the job to which the task belongs
  JobName := 'MyJob';
  // Specifies the name of the task
  TaskName := 'MyTask';
  // Obtains the task by its name
  Task := NetworkSuite.Jobs.ItemByName[JobName].Tasks.ItemByName[TaskName];

  // Specifies the host on which the task will be run
  Task.Host := NetworkSuite.Hosts.ItemByName['SlaveComputer1'];

  // Specifies the timeout period for the host
  Task.HostTimeOut := 6;

  // Specifies other task properties
  …

  // Runs the task
  Task.Run(true);
end;

C++Script, C#Script

function Test()
{
  var JobName, TaskName, Task;
  // Specifies the name for the job to which the task belongs
  JobName = "MyJob";
  // Specifies the name of the task
  TaskName = "MyTask";
  // Obtains the task by its name
  Task = NetworkSuite["Jobs"]["ItemByName"](JobName)["Tasks"]["ItemByName"](TaskName);

  // Specifies the host on which the task will be run
  Task["Host"] = NetworkSuite["Hosts"]["ItemByName"]("SlaveComputer1");

  // Specifies the timeout period for the host
  Task["HostTimeOut"] = 6;

  // Specifies other task properties
  …

  // Runs the task
  Task["Run"](true);
}

See Also

Distributed Testing
Host Property
Run Method
Verify Method
Host Object

Highlight search results