background image
<< Client/Server Testing - Running tests on one remote target | Client/Server Testing - Testing clients concurrently >>
Client/Server Testing - Testing clients plus server serially
<< Client/Server Testing - Running tests on one remote target | Client/Server Testing - Testing clients concurrently >>
User's Guide
375
21 I
MPLEMENTING
C
LIENT
/S
ERVER
T
ESTING
Testing clients plus server serially
[Montana] script2.t
[Montana] script3.t
Note that any spaces between the target Agent's name and the script name are
not significant.
Alternatively, to run testcases serially on multiple target machines, switch
among the target machines from within the script using 4Test's built-in
Connect and Disconnect functions. 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 target Agent's name as an
argument:
testcase TestSerially ()
STRING sMachine
// Define list of agent names
LIST OF STRING lsMachines = {...}
"Ohio"
"Montana"
// 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. Please
consider this example a step on the way to understanding parallel testing.
Testing clients plus server serially
In a client/server application, the server and its clients typically each run on
different target machines. This section explains how to build tests that test the
server and its clients in a serial fashion. In this scenario, the SetMachine
function switches among the target machines on which the server and its
clients are running. The following script fragment tests a client/server
database application in the following steps:
1
Connect to three target machines: server, client1, and client2.
2
Call the DoSomeSetup function, which calls SetMachine to make
"server" the current target machine, and then perform some setup.