MC
API
       
Subsystem
list
       
Top
level
       
Detailed
Status

Recovery Framework

This page is primarily of interest to those who maintain the API's and infrastructure. If you are a script writer, you will probably not be interested in the Recovery Framework. Instead, refer to the specific Recovery System for the application you're testing:

Note: if you are writing one script that tests more than one application (for example, the PRODUCT and the EDL Manager), then read this.

What is the Recovery Framework?

The QA Partner recovery system provides automatic recovery from errors that occur during the execution of a test script.

This subsystem, the Recovery Framework, provides a framework for supporting application-specific recovery systems. It also allows testing more than one application simultaneously, each with its own recovery system.

In general terms, a recovery system should do the following:

How the Recovery System works

The recovery system works by defining the following special QA Partner functions: Note that all of these functions are called automatically, behind your back. You do not need to -- in fact, you must not -- call them explicitly in your code.

Each of these functions essentially does one thing: it calls a method of the same name in your application's MainWin. For example, when testing the PRODUCT, ScriptEnter calls gwMCmainWin.ScriptEnter.

Specifying the Applications

If you are testing more than one application in one test script (for example, PRODUCT and EDL Manager), and you don't want the recovery system to automatically launch both applications, then you must explicitly tell the recovery system which application(s) to launch. If you're only testing one application, don't worry about this. The recovery system will launch the application you're testing.

You can tell the recovery system which application(s) to launch automatically by defining and initializing the variable gleRECapplications to be a list of RECapplication. You must do this in your script (.t) file. For example:

    list of RECapplication gleRECapplications = { eREC_APP_MEDIA_COMPOSER };
The data type RECapplication is an enum whose values define the applications that the recovery system knows about:
eREC_APP_MEDIA_COMPOSER
eREC_APP_EDL_MANAGER

Here's how this magic works:
ScriptEnter checks to see if the variable gleRECapplications is defined. (It will be only defined if you explicitly define it in your script.) If this variable is defined, ScriptEnter uses its value(s) to initialize the list of applications that will participate in the recovery system process.
If gleRECapplications is not defined, ScriptEnter checks to see if the main windows are defined for each application that it knows about (see list above). For each main window that is defined (for example, gwMCmainWin for the PRODUCT), ScriptEnter adds that application to the list of applications that will participate in the recovery system process. These windows will be defined if you include ("use") the appropriate .inc files in your script (for example, MCmainWin.inc for the PRODUCT). If you don't use it, it won't be defined, and the recovery system will ignore it.

Methods

In order for an application to participate in this recovery framework, it must define in its MainWin the following set of methods:

void ScriptEnter ()
void ScriptExit (boolean bException)
void TestCaseEnter ()
void TestCaseExit (boolean bException)

Routines

void RECaddApplication (window wMainWin)
void RECremoveApplication (window wMainWin)

void RECstubTestcase (string sExplanation)
void RECstubNextTestcase (string sExplanation)

boolean RECgetBooleanParam (string sParamName, out boolean bValue)
boolean RECgetIntegerParam (string sParamName, out integer iValue)
boolean RECgetListParam (string sParamName, out list of anytype laValue)
boolean RECgetRealParam (string sParamName, out real rValue)
boolean RECgetStringParam (string sParamName, out string sValue)
void RECgetAnyParam (string sName, inout ANYTYPE aVal)
void RECprintParamList (string sRECprintParamBoolean optional)
void RECdeleteParamList ()


myMainWin::ScriptEnter

This method is called once at the beginning of a test script. If you run a suite of several scripts, this method is called once at the beginning of each script. It is called before your script's main is called.

Declaration

void ScriptEnter (void);

Inputs

(none)

Outputs

(none)


myMainWin::ScriptExit

This method is called once at the end of a test script. If you run a suite of several scripts, this method is called once at the end of each script. It is called after your script's main is called. It is called regardless of whether an exception terminated the script. The recovery framework takes care of logging exceptions to the results file; your method should not do this.

Declaration

void ScriptExit (boolean bException);

Inputs

bException
TRUE if the script terminated because an exception was raised.
FALSE if the script terminated normally.

Outputs

(none)


myMainWin::TestCaseEnter

This method is called once at the beginning of each testcase.

Declaration

void TestCaseEnter (void);

Inputs

(none)

Outputs

(none)


myMainWin::TestCaseExit

This method is called once at the end of each testcase. It is called regardless of whether an exception terminated the testcase. The recovery framework takes care of logging exceptions to the results file; your method should not do this.

Declaration

void TestCaseExit (boolean bException);

Inputs

bException
TRUE if the testcase returned because an exception was raised.
FALSE if the testcase returned normally.

Outputs

(none)


RECaddApplication

This routine adds an application to the recovery framework. If the application is already part of the recovery framework, an exception is raised. This routine does not start the application.

Declaration

void RECaddApplication (window wMainWin);

Inputs

wMainWin
The main window for the application. Note that the window does not have to exist at the time RECaddApplication is called (i.e. the application does not have to be running yet).

Outputs

(none)


RECremoveApplication

This routine removes an application to the recovery framework. If the application is not part of the recovery framework, an exception is raised. This routine does not exit the application.

Declaration

void RECremoveApplication (window wMainWin);

Inputs

wMainWin
The main window for the application.

Outputs

(none)


RECstubTestcase

Sometimes it's necessary to temporarily stub out a testcase that causes catastrophic failure, so that the rest of a test script or suite can execute. If you need to stub out a testcase, call this routine at the top of the testcase. This will stub out all invocations of the testcase. If you want to stub out one or more (but not all) invocations of a testcase, use RECstubNextTestcase instead.

This routine raises an exception, which results in the testcase failing, without executing the rest of the testcase.

Declaration

void RECstubTestcase (string sExplanation);

Inputs

sExplanation
A description of why the testcase is stubbed out. Include a bug number if possible.

Outputs

(none)


RECstubNextTestcase

Sometimes it's necessary to temporarily stub out a testcase that causes catastrophic failure, so that the rest of a test script or suite can execute. If you need to stub out an invocation of a testcase, call this routine immediately before calling the testcase. It will cause the testcase to fail without actually executing the body of the testcase. If you need to stub out all invocations of a testcase, use RECstubTestcase instead.

Declaration

void RECstubNextTestcase (string sExplanation);

Inputs

sExplanation
A description of why the testcase is stubbed out. Include a bug number if possible.

Outputs

(none)


RECgetBooleanParam

This method of the application's main window (e.g. gwMCmainWin) returns the value of the named script parameter. If the parameter exists and has a value which is not a boolean, an exception is raised.

Declaration

boolean RECgetBooleanParam (string sParamName, out boolean bValue);

Inputs

sParamName
The name of the parameter.

Outputs

Returns
TRUE if the parameter was specified; FALSE if the parameter was not specified.
bValue
The value of the parameter, if it was specified. If the parameter was not specified, this output parameter is not set.


RECgetIntegerParam

This method of the application's main window (e.g. gwMCmainWin) returns the value of the named script parameter. If the parameter exists and has a value which is not an integer, an exception is raised.

Declaration

boolean RECgetIntegerParam (string sParamName, out integer iValue);

Inputs

sParamName
The name of the parameter.

Outputs

Returns
TRUE if the parameter was specified; FALSE if the parameter was not specified.
iValue
The value of the parameter, if it was specified. If the parameter was not specified, this output parameter is not set.


RECgetStringParam

This method of the application's main window (e.g. gwMCmainWin) returns the value of the named script parameter. If the parameter exists and has a value which is not a string, an exception is raised.

Declaration

boolean RECgetStringParam (string sParamName, out string sValue);

Inputs

sParamName
The name of the parameter.

Outputs

Returns
TRUE if the parameter was specified; FALSE if the parameter was not specified.
sValue
The value of the parameter, if it was specified. If the parameter was not specified, this output parameter is not set.


RECgetRealParam

This method of the application's main window (e.g. gwMCmainWin) returns the value of the named script parameter. If the parameter exists and has a value which is not a real, an exception is raised.

Declaration

boolean RECgetRealParam (string sParamName, out real rValue);

Inputs

sParamName
The name of the parameter.

Outputs

Returns
TRUE if the parameter was specified; FALSE if the parameter was not specified.
rValue
The value of the parameter, if it was specified. If the parameter was not specified, this output parameter is not set.


RECgetListParam

This method of the application's main window (e.g. gwMCmainWin) returns the value of the named script parameter. If the parameter exists and has a value which is not a list or record, an exception is raised.

Declaration

boolean RECgetListParam (string sParamName, out list of anytype laValue);

Inputs

sParamName
The name of the parameter.

Outputs

Returns
TRUE if the parameter was specified; FALSE if the parameter was not specified.
laValue
The value of the parameter, if it was specified. If the parameter was not specified, this output parameter is not set.


RECgetAnyParam

This function reads in the value of the named script parameter, of any data type. If a parameter file value is not available, it leaves the original default values unchanged. It requires that the variable have an initial default value, and raises an exception if it does not.

Each time it is called, RECgetAnyParam appends the parameter string to its private parameter list. A subsequent call to RECprintParamList outputs the list to the results file, in the form it requires in the parameter file. The script developer can then copy these lines into the parameter file.

Declaration

void RECgetAnyParam (string sName, inout ANYTYPE aVar);

Inputs

sName
The name of the parameter.
aVar
The (initialized) parameter variable.

Outputs

aVar
The new value of the parameter, if found in the parameter file, and the unchanged original value if not.

QAP Source Files

Shared/RECgetAnyParam.inc - RECgetAnyParam, RECmakeParamList, RECprintParamList.

Script Parameterization Procedure using RECgetAnyParam

Example:

(steps 1 - 3)


integer iInt = 1234;
RECgetAnyParam("iInt", iInt);

string sString = "hello";
RECgetAnyParam("sString", sString);

list of real rReal = {12.34, 56.78, 90.12};
RECgetAnyParam("rReal", rReal);

RECprintParamList();

(step 4: Run it.)

In the results file will be the following:
[ ] /////////////////////
[ ] // Data file input //
[ ] //--- Cut Here ----//
[ ] iInt = {"1234"};
[ ] sString = {"hello"};
[ ] rReal = {"12.340000", "56.780000", "90.120000"};

(step 5: Copy parameter lines into parameter file. Remove "[ ]" from first few columns.)

iInt = {"1234"};
sString = {"hello"};
rReal = {"12.340000", "56.780000", "90.120000"};

Your script will now read values from the parameter file.)

(step 6: Add the line "bRECprintParamList = FALSE" to the parameter file.


RECprintParamList

This function prints out the list of parameter input data generated by calls to RECgetAnyParam. It is designed to be controlled either by the default boolean parameter file variable "bRECprintParamList", or by a custom parameter named in the optional string argument, which takes precedence. If either of these are found, the printing takes place if the boolean is set TRUE. If neither variable is defined, the printing gets done by default. See RECgetAnyParam for a script parameterization procedure and example.)

Declaration

void RECprintParamList (string sRECprintParamListBOOLEAN optional);

Inputs

"bRECprintParamList"
The name of the (default) script parameter to control all calls to the function.
sRECprintParamListBOOLEAN
The name of the (custom) script parameter to control this call to the function.

Outputs

Returns
(none)
Prints out to results file
A list of the values passed to RECgetAnyParam, in the correct format to be read-in by RECgetAnyParam. (This is always a list of string, or some compound form of a list of string.)


RECdeleteParamList

This function empties the private parameter list. A subsequent call to RECgetAnyParam will start a new list.

Declaration

void RECdeleteParamList ();

Inputs

(none)

Outputs

(none)



This page is maintained by (REMOVED).

Last updated 7 April 1998.


Source Management using