background image
<< Multi-Application - Multi-application startup and recovery | Multi-Application - Required testcase code >>
Multi-Application - Testcase structure in a multi-application environment
<< Multi-Application - Multi-application startup and recovery | Multi-Application - Required testcase code >>
User's Guide
383
22 M
ULTI
-A
PPLICATION
T
ESTING
Testcase structure in a multi-application environment
DefaultScriptExit -- logs an exception to the results file when a script
exits because of an exception.
DefaultTestcaseEnter -- executes the SetAppState function. If you have
specified an application state for this testcase, the SetAppState function
brings your test application to that state. If you have no application state
defined, SetAppState brings the application to the base state (if
necessary).
DefaultTestcaseExit -- logs an exception to the results file when a
testcase exits because of an exception. The function then executes the
SetBaseState function, which calls a base state function that you have
defined or the DefaultBaseState function.
The word "Default" in each of the above function names signifies that you
can define alternative functions to replace these. If, for example, you define a
function called TestcaseEnter, 4Test will invoke your function before
executing any of the code in your testcase and will not invoke
DefaultTestcaseEnter.
Other include files
Your testcase needs certain definitions that other testcases in your testing
program will also need. These include:
Window declarations
Application states
Utility functions
Placing these general purpose definitions in an include file (or several smaller
files) saves repetitive coding. When you use SilkTest to record window
declarations and application states, SilkTest names the generated file
frame.inc.
Testcase structure in a multi-application environment
This section describes some SilkTest components that enable concurrent
testing of more than one application. For example, there are functions that
make it possible to drive both the client application and the client's server
from SilkTest, to set each to its base state, and to recover each if it fails.
Invoking a testcase
The keyword for a testcase declaration is different when you are performing
distributed testing. Instead of preceding the testcase function declaration with
the keyword testcase, you must use the keyword multitestcase to give your
testcase the multi-application recovery system. Declaring a function as a
multitestcase gives that function the ability to invoke functions declared with
the keyword testcase. A multitestcase thus can be viewed as a wrapper for