PROLOGUE
C++ Test Script Language
Syntax
PROLOGUE { <prologue item>* }
Location
TEST CLASS | TEST SUITE
Description
The PROLOGUE statement defines native code that is to be executed whenever the surrounding test class execution begins. This code is executed before any other of the test class' components.
The PROLOGUE statement may appear at most once in a test class. In an object-context, a prologue can be compared to a constructor.
<prologue item> may be one of the following entities:
-
COMMENT
-
PRINT
-
Native statement
Order is meaningful. The native code can be made of declarations and instructions. Variables declared in prologue are visible from every component of the surrounding test class.
Note If the native code raises an exception, the prologue generates an error, handled by the ON ERROR local block. Even if the ON ERROR statement is CONTINUE, the whole TEST CLASS or TEST SUITE is skipped, including its EPILOGUE.
Example
TEST CLASS ATest
{
PROLOGUE {
#Stack s(20);
#s.fill ();
}
TEST CASE tc1 {
CHECK (!s.full ());
}
RUN {
tc1;
}
}