Name Property

Applies to TestComplete 15.69, last modified on November 13, 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 Name property returns the unique name of the given host in the network suite's host collection (the Name property of the host). This name can be used to identify the host in this collection via the Hosts.ItemByName property and to assign this host to a task via the Task.Host property.

Declaration

HostObj.Name

Read-Only Property String
HostObj An expression, variable or parameter that specifies a reference to a Host object

Applies To

The property is applied to the following object:

Property Value

A string that represents the unique name that the given host has in the host collection of the network suite.

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
Host.Index
Hosts Object
Hosts.ItemByName
Task.Host

Highlight search results