Running Tests Serially on Multiple Targets

To run your scripts or suites serially on multiple target machines, specify the name of the target Agent within the suite file. For example, the following code runs a suite of three scripts serially on two target machines named Ohio and Montana:
[Ohio] script1.t
[Ohio] script2.t
[Ohio] script3.t
[Montana] script1.t
[Montana] script2.t
[Montana] script3.t

Any spaces between the name of the target Agent and the script name are not significant.

Alternatively, to run test cases serially on multiple target machines, switch among the target machines from within the script, by using the Connect and Disconnect functions of 4Test. For example, the following script contains a function named DoSomeTesting that is called once for each machine in a list of target machines, with the name of the target Agent as an argument:
testcase TestSerially ()
  STRING sMachine
  // Define list of agent names
  LIST OF STRING lsMachines = {...}

  // Invoke test function for each name in list
  for each sMachine in lsMachines
    DoSomeTesting (sMachine)

  // Define the test function
  DoSomeTesting (STRING sMachine)
    Connect (sMachine)
    Print ("Target machine: {sMachine}")
    // do some testing...
    Disconnect (sMachine)

You will rarely need to run one test serially on multiple machines. Consider this example a step on the way to understanding parallel testing.