background image
<< C++ Testing Overview | Files and Classes Under Test >>
<< C++ Testing Overview | Files and Classes Under Test >>

C++ Contract-Check Script

Automated Testing
·
<source>.cpp: is an additional source file
C++ Contract-Check Script
The C++ Contract Check script allows you to test invariants and state charts as well
as wraps for each method of the class.
The Contract Check script is contained in an .otc file, whose name matches the name
of the file containing the class definition.
C++ Contract Check scripts are written in C++ Contract Check Language, which is
part of the C++ Test Script language designed for Component Testing for C++.
You can use the Component Testing wizard to set up a test node and create the C++
contract-check script templates or you can manually create a Component Testing for
C++ test node to reuse existing test scripts.
An .otc contract-check script must be executed before an .otd Test Driver script,
therefore the order in which both script types appear in the Test node is critical. This
is important if you are manually creating a test node.
See the Rational Test RealTime Reference Manual for the semantics of the C++
Contract Check Language.
C++ Test Driver Script
The C++ Test Driver Script stimulates the source code under test to test assertions on
a cluster of classes.
The test driver script itself is contained in an .otd file and may call two optional files:
·
A declaration file (.dcl) that contains C++ code that ensures the types, class,
variables and functions needed by your test script will be available in your
code.
·
A stub file (.stb) whose purpose is to define variables, functions and methods
which are to be stubbed.
Using a separate declaration and stub files is optional. It is possible to include all or
certain declarations and stubs directly within the test driver script file.
C++ Contract Check scripts are written in C++ Contract Check Language, which is
part of the C++ Test Script Language designed for Component Testing for C++.
You can use the Component Testing wizard to set up a test node and create the C++
Test Driver script templates or you can manually create a Component Testing for
C++ test node to reuse existing test scripts.
An .otc contract-check script must be executed before an .otd Test Driver script,
therefore the order in which both script types appear in the Test node is critical. This
is important if you are manually creating a test node.
165