background image
<< Multi-Application - Testcase structure in a multi-application environment | Multi-Application - invokes SetMultiBaseStates and DisconnectAll >>
Multi-Application - Required testcase code
<< Multi-Application - Testcase structure in a multi-application environment | Multi-Application - invokes SetMultiBaseStates and DisconnectAll >>
384
User's Guide
22 M
ULTI
-A
PPLICATION
T
ESTING
Testcase structure in a multi-application environment
stand-alone testcases; it provides a means of assigning tests to particular
machines and lets you invoke previously written testcases from the
multitestcase file by simply adding a use statement to the file to include the
testcase definitions.
In the single-application environment, you invoke a testcase with no
arguments or you may specify an application state function. When you are
using multi-application environment support, you can pass the testcase the
names of the machines to be tested during that execution of the testcase, but
not the application state function. In a multi-application environment, one
testcase can use multiple application states; you specify these in the required
code at the beginning of the testcase (see "Required testcase code" next).
Required testcase
code
There are certain functions that you must invoke in every testcase being used
for multi-application testing. These functions enable you to drive several
different applications at the same time and to map the different applications
and associated application states to particular machines. After you have
specified the application-to-machine mapping, you invoke another function
that initializes all your test machines in preparation for your tests. The
sections "Code for template.t" on page 386 and "template.t explained" on
page 387 pr
ovide a detailed explanation of the required code.
defaults.inc
The multi-application environment uses the same defaults.inc file as does the
single-application environment. However, when you define a function as a
multitestcase, 4Test uses functions defined in the cs.inc file to invoke
functions in defaults.inc. Thus it can pass the appropriate application states or
base states to these functions, depending on the requirements of a particular
test machine.
cs.inc
cs.inc is an automatically included file that contains functions used only in
the multi-application environment. The following four functions provide a
recovery system for managing automated testing of client/server applications.
·
SetMultiAppStates -- sets an application state for each connected
machine, if the "AppState" machine data lists one; if not, it calls the
DefaultBaseState function, which sets the application to its main
window.
·
SetMultiBaseStates -- sets the application to the lowest state in the
application state hierarchy for each connected machine, if the "AppState"
machine data lists an application state. The lowest application state is one
in which the appstate declaration did not use the basedon keyword. If
there is no "AppState" information associated with this machine,
SetMultiBaseStates calls the DefaultBaseState function, which sets the
application to its main window, invoking it beforehand if necessary.