C++ Test Driver Script

Component Testing for C++

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:

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++.

A typical Component Testing .otd test script looks like this:

INCLUDE "Test.dcl";

TEST CLASS TestClass1 {

    PROLOGUE   {

        <Declarations of variables>

        <Actions to be performed before executing this test class.>


    TEST CASE Test1  {


        CHECK (expression_must_be_true == true);


    EPILOGUE   {

        <Actions to be performed when leaving the test class>


    RUN {





    TestClass1   (File<char*>);



See the Reference section for the semantics of the C++ test driver language.

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.

See the Reference section for the semantics of the C++ Contract Check Language.

Related Topics

C++ Contract-Check ScriptComponent Testing WizardUsing native C++ statements