background image
<< Client/Server Testing - How 4Test handles script deadlock | Client/Server Testing - testcase ParallelRandomLoadTest >>
Client/Server Testing - Testing in parallel, but not synchronously
<< Client/Server Testing - How 4Test handles script deadlock | Client/Server Testing - testcase ParallelRandomLoadTest >>
378
User's Guide
21 I
MPLEMENTING
C
LIENT
/S
ERVER
T
ESTING
Testing in parallel, but not synchronously
DoSomeSetup ("server")
Disconnect ("server")
parallel
UpdateDatabase ("client1") // thread for client1
UpdateDatabase ("client2") // thread for client2
// automatic synchronization
Disconnect ("client1")
Disconnect ("client2")
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)
Note If you use variables to specify different database records for
each client's database transactions, you can use the above techniques
to guarantee parallel execution without concurrent database
accesses.
Testing in parallel, but not synchronously
This section illustrates a method for running test functions in parallel on
multiple clients, but with different tests running on each client. This provides
a realistic multi-user load--as opposed to a load in which all clients perform
the same operations at roughly the same time.