background image
<< Multi-Application - the multitestcase keyword | Multi-Application - if-else construct >>
Multi-Application - rendezvous statement
<< Multi-Application - the multitestcase keyword | Multi-Application - if-else construct >>
User's Guide
393
22 M
ULTI
-A
PPLICATION
T
ESTING
Concurrency test explained
with all currently running threads. In this example, a thread is started for each
machine in the list of machines being tested. 4Test sends the statements in the
indented code block to the Agents on each machine and then waits at the
rendezvous statement until all Agents report that all the code statements have
been executed.
The following is the code defined for the spawn statement:
// The code to be executed in parallel by
// all machines:
SetMachine (sMachine)
Personnel.EmployeeList.Select ("John Doe")
Personnel.Employee.Edit.Pick ()
Employee.Salary.SetText
[STRING] RandInt (50000, 70000))
Each thread executes operations that prepare for an attempt to perform
concurrent writes to the same database record. The SetMachine function
establishes the Agent that is to execute the code in this thread. The next two
statements drive the application's user interface to select John Doe's record
from the employee list (a PopupList) and then to pick the Edit option from
the Employee menu. This opens the Employee dialog box and displays John
Doe's employee record. The last thread operation sets the salary field in this
dialog box to a random number. At this point the client is prepared to attempt
a write to John Doe's employee record. When this point has been reached by
all clients, the rendezvous statement is satisfied, as described above, and
4Test can continue with the next script statement.
for each sMachine in lsMachine
spawn
SetMachine (sMachine)
Employee.OK.Click ()
if (MessageBox.Exists (ACCEPT_TIMEOUT))
SetMachineData (NULL, "sMessage",
MessageBox.Message.GetText ())
MessageBox.OK.Click ()
Employee.Cancel.Click ()
else if (Employee.Exists ())
AppError ("Employee dialog not dismissed
after {ACCEPT_TIMEOUT} seconds")
rendezvous