C++ test driver script structure

A Component Testing for C++ test driver script (.otd script) describes a test driver. Its purpose is to stimulate the tested classes by creating objects and calling their methods. It provides different ways to check that the objects behavior is the one that was expected.

When executed, the script is translated into a C++ source by Component Testing for C++. Furthermore, it instruments the source code under test whenever the STUB, CHECK STUB, or CHECK METHOD statements are used.

Order is meaningful for INCLUDE and native statements. RUN may appear only once in a C++ Test Driver script. Other entities are not ordered: for instance, a TEST CLASS can forward-reference a STUB.

Note   A C++ Test Driver script is made both of statements and instructions. Instructions are ordered: their relative position is meaningful. Statements have no order: they have a declarative nature.

Basic structure

A typical Component Testing .otd test script structure could look like this:

TEST CLASS TestAnyPhilosopher (Philosopher_type)

{

TEST CLASS TestNominal (Philosopher_type)

{

PROLOGUE

{

// Actions to be performed when entering this test class.

}

TEST CASE AssignForks

{

// CHECK statements

}

EPILOGUE

{

// Actions to be performed when leaving this test class.

}

RUN

{

// Runs the test cases

}

}

RUN

{

// Runs the test class

}

 

 

All instructions in a test script have the following characteristics:

Structure statements

The following statements allow you to describe the structure of a test.

Related Topics

TEST CLASSPROLOGUETEST CASEEPILOGUERUN