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
22 M
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.
SetMachine (sMach2)
// Here is placed code that drives test operations
// . . .
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
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
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.
multitestcase MyTest (LIST OF STRING lsMachine)
STRING sMachine
INTEGER iSucceed
for each sMachine in lsMachine
SetUpMachine (sMachine, Personnel)