background image
<< Multi-Application - GUI-based applications | Multi-Application - DefaultBaseState function >>
Multi-Application - Code for concurrency test example
<< Multi-Application - GUI-based applications | Multi-Application - DefaultBaseState function >>
User's Guide
389
22 M
ULTI
-A
PPLICATION
T
ESTING
Code for concurrency test example
machines at the same time--however, this is usually the case. The
SetMachine function directs 4Test to execute this thread's code by means of
the Agent on the specified machine. This thread can then go on to drive a
portion, or all, of the test operations for this machine.
spawn
SetMachine (sMach2)
// Here is placed code that drives test operations
rendezvous
// . . .
The second spawn statement starts the thread for the second machine in this
template. The rendezvous statement blocks the execution of the calling
thread until all threads spawned have completed. You can use the rendezvous
statement to synchronize machines as necessary before continuing with the
testcase.
Code for concurrency test example
The concurrency test example shown below is designed to allow any number
of test machines to attempt to access a server database at the same time. This
tests for problems with concurrency, such as deadlock or out-of-sequence
writes.
This example uses only one application. However, it is coded in the style
required by the multi-application environment because you will probably
want to use an Agent to start and initialize the server during this type of test.
There is no requirement in the client/server environment that you use the
single-application style of testcase just because you are driving only one
application. For consistency of coding style, you will probably find it
convenient to always use the multi-application files and functions.
The section after this one explains this code example in detail.
const ACCEPT_TIMEOUT = 15
multitestcase MyTest (LIST OF STRING lsMachine)
STRING sMachine
INTEGER iSucceed
STRING sError
for each sMachine in lsMachine
SetUpMachine (sMachine, Personnel)