| Test Automation | Subsystem List | Top level |
| Passing Parameters to Scripts | Retrieving Parameters | Using Parameter Files | More About Scripts and Parameters | Implementation Details | Parameter Methods |
| Standard Parameters | PRODUCT Parameters | Recovery Framework | PRODUCT Recovery System |
Some examples of script parameters are:
From the user's perspective, there are three ways to pass parameters to a script:
glsREC_DEFAULT_PARAMETER_FILE
parameter in your MClocal.inc file.
For example, let's say we have a script named "MyScript.t", and we want to pass it a parameter named "Project" whose value is "MyPALproject". In order to do this, we would need a test suite that contained the following line:
MyScript.t "Project = 'MyPALproject';"Notice the double quotes around the entire assignment statement.
In suite (.s) files -- and nowhere else -- QAP treats every sequence of non-white spaces as a single script argument and throws away the intervening spaces, unless the sequence begins with a single or double quote. When QAP encounters a single quote (following a space) it takes everything up to the next single quote as a single script argument, keeping the single quotes. When QAP encounters a double quote (following a space) it takes everything up to the next single quote as a single script argument -- and throws away the enclosing double quotes.
Here are some examples of how QAP translates suite file arguments, and whether or not the example will work:
What Appears in the Suite File   
| What Your Script Gets as Arguments   
| Works? |
|---|---|---|
script.t x=5;
| x=5;
| yes |
script.t x = 5;
| x   =   5;
| yes |
script.t x="hello";
| x="hello";
| yes |
script.t x = "hello";
| x   =   hello   ;
| NO |
script.t 'x="hello";'
| 'x="hello";'
| NO |
script.t 'x = "hello";'
| 'x = "hello";'
| NO |
script.t "x='hello';"
| x='hello';
| yes |
script.t "x = 'hello';"
| x = 'hello';
| yes |
Thus, to ensure that parameter assignment statements are interpreted correctly, you must enclose each one (or all of them together) in double quotes -- but only in suite files.
// MyScript.t
use "MCdefs.inc";
main ()
{
string sProjName = "DefaultProject";
RECgetStringParam("Project", sProjName);
gwPRJwindow.OpenNewProject(sProjName);
}
|
In the preceding example, OpenNewProject
will open the project "MyPALproject".
// MyParamFile.dat DefaultProject = "myProject"; ProjectFormat = "PAL"; NumberOfAudioTracks = 4; SequenceName = "MySequence"; DeleteMediaFiles = FALSE; |
Note that the syntax for parameters is different, depending on whether the parameters are in a parameter file or in a suite file. This is because QAP treats suite file arguments in a less-than-ideal manner, over which we have no control. On the other hand, we have complete control over the syntax of parameter files, and thus can make the syntax more reasonable. You can find a complete description of parameter file syntax here.
Once you have a parameter file, you can pass the name of the parameter file to your script through a suite file, for example:
MyScript.t "use MyParamFile.dat";Note that you must put quotes around the "use" statement in a suite file.
You can pass any number of parameters or parameter files to a script. If a parameter is defined in more than one file, the rightmost one takes precedence. If you specify a parameter twice in the same file, an exception is raised.
glsMC_INPUT_DATA_DIR
constant in MClocal.inc.
Parameter files should live in the appropriate subsystem's directory
in the input data directory.You can also use a fully qualified path name in a "use" statement, but this practice should be avoided.
The default parameter file, which is read automatically by the recovery system,
is specified by the
glsREC_DEFAULT_PARAMETER_FILE
parameter in your MClocal.inc file.
Many parameters will be ignored by many scripts. The documentation (web page) for each script must document which parameters, if any, the script uses.
Parameters are intended to be used as arguments to a script,
i.e. to main().
They must never be used implicitly inside subsystem APIs,
except for the Recovery System.
Parameter values must never be modified by a script.
You can find a list of pre-defined system parameters here. If your script needs parameters that are specific to that script alone, those parameter names should begin with the subsystem prefix.
ScriptEnter).
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)
|
The following routines are provided by other subsystems for retrieving more complex parameters.
boolean
| MONgetClipParam
| (string sParamName, out string sClipName, out string sMarkIn, out string sMarkOut,
out MONposTypeAndTrack uPosType)
|
boolean
| MONgetPosTypeParam
| (string sParamName,
out MONposTypeAndTrack uPosType)
|