UserName Property

Applies to TestComplete 15.63, last modified on April 23, 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 UserName property specifies the user account that will be used to log in on the given host (see the UserName property of the host).

Declaration

HostObj.UserName

Read-Write 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 user account used to log in on the host.

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
Password Property
Domain Property

Highlight search results