| APIs |
|
The target audience is script writers and maintainers of infrastructure.
General Philosophy | Writing a Test Script | Maintaining Infrastructure | Test Execution |
See also How to Read a Results File.
See also Formal Grammar.
CUlogGuiAction).
This is handled for you by the infrastructure.
LogError!When your script discovers an error condition, it should log the error in the results file in one of a number of different ways, depending on whose fault the error is:
| Application Errors | These are errors in the application.
If your script or testcase can reasonably continue executing after discovering
an error, then report it using this routine:void CUlogError
(string sErrorMessage);If your script or testcase cannot reasonably continue executing after discovering an error, then report it by raising an exception with a 4Test raise statement.
|
| Programming Errors | These are errors made by the script writer (you), not by an application developer. Check for them using Assertions. |
| Setup Errors | These are error made by the person running your script.
Check for them and/or log them using these routines:void RequireSetup
(boolean bCondition, string sExplanation)void CUsetupError
(string sExplanation)
|
[string].
You can also embed the values of variables in a string by enclosing
the variable name in curly braces { }.
If you must log an exception, always use the following routine:
void CUlogException
(string sAdditionalInfo optional);
Print statements), not data that is generated
by the application (i.e. bins, clips, EDLs, media files, etc.).Output data must be clearly distinguished from other lines in the results file in one of the following ways:
ResOpenList and ResCloseList.
Provide a string to ResOpenList that will distinguish
the indentation block from other lines in the file, such as "Data".
Don't put anything other than output data in this block.
This approach works best for moderate amounts of data.
void CUlogOutputFileName
(string sFileName, string sDescription optional)
CUtestcaseFeature
(see below).
If it is convenient, you can block out sections of your test that
test a particular functional area by calling the following routines:
CUlogBlockState CUbeginFeatureTest (CUfeatureOrList)
void CUendFeatureTest (CUfeatureOrList)
For example, if you are testing the functional areas "Digitize | Functions | Batch Digitize | Drop" and "Digitize | Functions | Batch Digitize | Non-Drop", you can report the functional areas in one of two ways.
testcase tcTestDrop ()
{
CUtestcaseFeature({"Digitize","Functions","Batch Digitize","Drop"});
... body of test ...
}
testcase tcTestNonDrop ()
{
CUtestcaseFeature({"Digitize","Functions","Batch Digitize","Non-Drop"});
... body of test ...
}
main.
testcase tcTestDrop ()
{
CUtestcaseFeature("Drop");
... body of test ...
}
testcase tcTestNonDrop ()
{
CUtestcaseFeature("Non-Drop");
... body of test ...
}
main ()
{
CUbeginFeatureTest({"Digitize","Functions","Batch Digitize"});
tcTestDrop();
tcTestNonDrop();
CUendFeatureTest({"Digitize","Functions","Batch Digitize"});
}
For more information on features and functional areas, click here.
| 1. | eCU_TEST_SETUP
| Perform any setup that the test requires, such as opening bins, loading sequences, changing settings, etc. Some tests may not require any setup; some or all of a test's setup may be performed implicitly by the recovery system. |
| 2. | eCU_TEST_EXECUTE
| This phase should only include the operation being tested. Typically, this phase will consist of a single call to a subroutine or method. Every test must include this phase. |
| 3. | eCU_TEST_VERIFY
| Verify the results of the test, to ensure that the test was successful. Some verification may be performed implicitly by the infrastructure and/or the recovery system. |
| 4. | eCU_TEST_CLEANUP
| Perform any cleanup that the test requires, such as deleting sequences, closing dialogs, etc. You should normally leave around anything that the test created, so that it can be examined after the test script finishes running. Most tests will not require this phase. |
| 5. | eCU_TEST_RESULTS
| Display any results of the test. Most scripts will not use this phase; it is intended for scripts which first perform a set of tests, gathering data as they go along, and then print all the gathered data at the end. |
Some of this reporting is taken care of for you by the Recovery System. Here is a summary:
ScriptEnter (the beginning of a script) sets the test phase to eCU_TEST_SETUP.
eCU_TEST_SETUP.
eCU_TEST_CLEANUP.
CUbeginFeatureTest,
it sets the test phase to eCU_TEST_SETUP.
CUendFeatureTest,
it sets the test phase to eCU_TEST_CLEANUP.
eCU_TEST_EXECUTE
immediately before executing the actual test. You may also set other test phase
as needed. To set the test phase, call this routine:
void CUlogTestPhase
(CUtestPhase ePhase);
CUtestcaseFeature.
You should call it near the top of the body of your testcase.
Within each testcase, you must indicate the beginning of the actual test
(as opposed to setup for the test) by calling
CUlogTestPhase.
If your testcase performs an cleanup after executing the test, you must
indicate that with another call to
CUlogTestPhase.
If your testcase takes parameters, then it must log information that
distinguishes between different invocations of the testcase.
Do this by placing a call to
CUdisambiguateTC
near the top of the body of the testcase.
Print and Printf.You can begin any line with a period; such lines will never be interpreted to have special meaning.
void CUdebugPrint
(string sSubSystemPrefix, varargs of anytype);
You need not explicitly test a debugging flag before calling this routine;
that functionality is built into CUdebugPrint.
Reserved Characters
Do not begin any lines of output with any of the following sequences of characters.
They have special meaning to tools that read and interpret results files.
You may use these sequences within a line, as long as they are not the
first characters on the line.
* asterisk- hyphen< less than> greater than+ plus |
: colon[ open bracket] close bracket( open paren.) close paren. |
/ forward slash\ backslash! exclamation@ at# sharp |
$ dollar% percent^ circumflex& ampersand_ underscore |
= equals? question markScriptSuiteTestcase |
A line beginning with a period will never be interpreted to have special meaning.
void CUlogGuiAction
(string sAction, window w);
The action string should begin with a present-tense verb such as "click", "type", "select", or "close", and end in a preposition such as "in", "on", "to", or "from". If the verb takes both a direct and an indirect object, make sure that the one that isn't the window is included in the action string. For example, when reporting the selection of a menu item from a popup menu, include the name (or number) of the item in the action string.
The window should be the window, control, or pane that the action is being
performed on.
When calling CUlogGuiAction from a method, the window will almost
always be "this".
CUlogGuiAction automatically reports the window's parents.
void CUdebugPrint
(string sSubSystemPrefix, varargs of anytype);
You need not explicitly test a debugging flag before calling this routine;
that functionality is built into CUdebugPrint.
The name of the testbed must be provided in the LocalConstants.inc
file by defining the following variable:
const string gsMC_TESTBED = "Lab System #1 (Moe)";
The internal release name of the product under test must be provided through
the standard script parameter
sMCinternalReleaseName.
Examples are "Twister", "Jaguar", "Whirlpool".
Last updated 12 May 2000.