background image
<< Client/Server Testing - Testing clients plus server serially | Client/Server Testing - How 4Test handles script deadlock >>
Client/Server Testing - Testing clients concurrently
<< Client/Server Testing - Testing clients plus server serially | Client/Server Testing - How 4Test handles script deadlock >>
376
User's Guide
21 I
MPLEMENTING
C
LIENT
/S
ERVER
T
ESTING
Testing clients concurrently
3
Call the UpdateDatabase function once for each client machine. The
function sets the target machine to the specified client, then does a
database update. It creates a timer to time the operation on this client.
4
Disconnect from all target machines.
testcase TestClient_Server ()
Connect ("server")
Connect ("client1")
Connect ("client2")
DoSomeSetup ("server")
UpdateDatabase ("client1")
UpdateDatabase ("client2")
DisconnectAll ()
DoSomeSetup (STRING sMachine)
HTIMER hTimer
hTimer = TimerCreate ()
TimerStart (hTimer)
SetMachine (sMachine)
//
code to do server setup goes here
TimerStop (hTimer)
Print ("Time on {sMachine} is: {TimerStr (hTimer)}")
TimerDestroy (hTimer)
UpdateDatabase (STRING sMachine)
HTIMER hTimer
hTimer = TimerCreate ()
TimerStart (hTimer)
SetMachine (sMachine)
// code to update database goes here
TimerStop (hTimer)
Print ("Time on {sMachine} is: {TimerStr (hTimer)}")
TimerDestroy (hTimer)
The preceding example shows how you direct sets of testcase statements to
particular machines. If you were doing functional testing of one application,
you might want to drive the server first and then the application. However,
this example is not realistic because it does not show the support necessary to
bring the different machines to their different application states and to
recover from a failure on either machine.
Testing clients concurrently
This section demonstrates one way to perform the same tests concurrently on
multiple clients. In concurrent testing, SilkTest executes one function on two
or more clients at the same time.