CopyProjectToSlave Method

Applies to TestComplete 14.60, last modified on April 22, 2021

Description

A host’s CopyProjectToSlave method copies a test project from the master computer to this host. The project location on the master computer is specified by the host’s ProjectSourcePath property. The destination folder on the host is specified by the BasePath property.

Declaration

HostObj.CopyProjectToSlave()

HostObj An expression, variable or parameter that specifies a reference to a Host object
Result None

Applies To

The method is applied to the following object:

Result Value

None.

Remarks

If the project to copy is not specified (that is, the host’s ProjectSourcePath property is blank), CopyProjectToSlave copies the project suite folder.

CopyProjectToSlave does not copy:

Example

The following example adds a remote computer to a network suite (distributed test), copies a test project from the current computer to the remote computer and starts the network suite.

JavaScript, JScript

function CopyProjectToSlave()
{
  // Create a new host
  var Host = NetworkSuite.Hosts.AddNew();
  // Specify the connection properties of the host
  Host.Name = "NewHost";
  Host.Address = "TEST-W764";
  // ...
  // Specify the base path and source path host properties
  Host.ProjectSourcePath = "C:\\Work\\MyProjects\\";
  Host.BasePath = "C:\\SlaveProjects\\";
  // Copy the project from the master computer to a slave computer
  Host.CopyProjectToSlave();
  // ...
  // Run the network suite
  NetworkSuite.Run(true);
}

Python

def CopyProjectToSlave():
  # Create a new host
  Host = NetworkSuite.Hosts.AddNew()
  # Specify the connection properties of the host
  Host.Name = "NewHost"
  Host.Address = "TEST-W764"
  Host.UserName = "tester"
  Host.Password = "123"
  # ...
  # Specify the base path and source path host properties
  Host.ProjectSourcePath = "C:\\Work\\MyProjects\\"
  Host.BasePath = "C:\\SlaveProjects\\"
  # Copy the project from the master computer to a slave computer
  Host.CopyProjectToSlave()
  # ...
  # Run the network suite
  NetworkSuite.Run(True)

VBScript

Sub CopyProjectToSlave
  Dim Host
  ' Create a new host
  Set Host = NetworkSuite.Hosts.AddNew
  ' Specify the connection properties of the host
  Host.Name = "NewHost"
  Host.Address = "TEST-W764"
  ' ...
  ' Specify the base path and source path host properties
  Host.ProjectSourcePath = "C:\Work\MyProjects\"
  Host.BasePath = "C:\SlaveProjects\"
  ' Copy the project from the master computer to a slave computer
  Host.CopyProjectToSlave
  ' ...
  ' Run the network suite
  NetworkSuite.Run True
End Sub

DelphiScript

procedure CopyProjectToSlave;
var Host;
begin
  // Create a new host
  Host := NetworkSuite.Hosts.AddNew;
  // Specify the connection properties of the host
  Host.Name := 'NewHost';
  Host.Address := 'TEST-W764';
  // ...
  // Specify the base path and source path host properties
  Host.ProjectSourcePath := 'C:\Work\MyProjects\';
  Host.BasePath := 'C:\SlaveProjects\';
  // Copy the project from the master computer to a slave computer
  Host.CopyProjectToSlave;
  // ...
  // Run the network suite
  NetworkSuite.Run(true);
end;

C++Script, C#Script

function CopyProjectToSlave()
{
  // Create a new host
  var Host = NetworkSuite["Hosts"]["AddNew"]();
  // Specify the connection properties of the host
  Host["Name"] = "NewHost";
  Host["Address"] = "TEST-W764";
  // ...
  // Specify the base path and source path host properties
  Host["ProjectSourcePath"] = "C:\\Work\\MyProjects\\";
  Host["BasePath"] = "C:\\SlaveProjects\\";
  // Copy the project from the master computer to a slave computer
  Host["CopyProjectToSlave"]();
  // ...
  // Run the network suite
  NetworkSuite["Run"](true);
}

See Also

Distributed Testing
Copying Slave Projects to Remote Computers

Highlight search results