Host Object

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 Host object represents a host in the network suite. A host is a computer TestComplete can access on the network (see Editing Host Properties).

To get the host specified for the given task, use the Task.Host property. To get the host as part of the host collection represented by the Hosts object, use the Hosts.Items or Hosts.ItemByName property.

Members

Example

The code below creates a new host, specifies properties for it (name, address, user name, and so on) and then checks whether the created host can be used by a network suite.

JavaScript, JScript

function HostObj()
{
  // Creates a new host
  var Host = NetworkSuite.Hosts.AddNew();
  // Specifies the host's parameters
  Host.Name = "Host1";
  Host.Address = "TEST-W764";
  Host.Domain = "EDGS";
  Host.UserName = "tester";
  Host.Password = "123";
  
  // Verifies whether the created host can be used by a network suite
  if (Host.Verify)
    Log.Message("The host properties are valid.")
  else
    Log.Warning("The host properties aren't valid.");
}

Python

def HostObj():
  # Creates a new host 
  Host = NetworkSuite.Hosts.AddNew()
  # Specifies the host's parameters 
  Host.Name = "Host1"
  Host.Address = "TEST-W764"
  Host.Domain = "EDGS"
  Host.UserName = "tester"
  Host.Password = "123"
  # Verifies whether the created host can be used by a network suite 
  if Host.Verify:
    Log.Message("The host properties are valid.")
  else: 
     Log.Warning("The host properties aren't valid.")

VBScript

Sub HostObj

  ' Creates a new host
  Set Host = NetworkSuite.Hosts.AddNew
  ' Specifies the host's parameters
  Host.Name = "Host1"
  Host.Address = "TEST-W764"
  Host.Domain = "EDGS"
  Host.UserName = "tester"
  Host.Password = "123"
  
  ' Verifies whether the created host can be used by a network suite
  If Host.Verify Then
    Log.Message("The host properties are valid.")
  Else
    Log.Warning("The host properties aren't valid.")
  End If
  
End Sub

DelphiScript

function HostObj;
var Host;
begin

  // Creates a new host
  Host := NetworkSuite.Hosts.AddNew;
  // Specifies the host's parameters
  Host.Name := 'Host1';
  Host.Address := 'TEST-W764';
  Host.Domain := 'EDGS';
  Host.UserName := 'tester';
  Host.Password := '123';
  
  // Verifies whether the created host can be used by a network suite
  if (Host.Verify) then
    Log.Message('The host properties are valid.')
  else
    Log.Warning('The host properties aren''t valid.');

end;

C++Script, C#Script

function HostObj()
{
  // Creates a new host
  var Host = NetworkSuite["Hosts"]["AddNew"]();
  // Specifies the host's parameters
  Host["Name"] = "Host1";
  Host["Address"] = "TEST-W764";
  Host["Domain"] = "EDGS";
  Host["UserName"] = "tester";
  Host["Password"] = "123";
  
  // Verifies whether the created host can be used by a network suite
  if ( Host["Verify"] )
    Log["Message"]( "The host properties are valid." )
  else
    Log["Warning"]( "The host properties aren't valid." );
}

See Also

Distributed Testing
Editing Host Properties
Items Property
ItemByName Property
Host Property

Highlight search results