TEST CLASS

C++ Test Script Language

Syntax

TEST CLASS <test_class_name> [<formal_parameter> [ , <formal_parameter> ]] [: <parent_class>] [<actual_parameter> [, <actual_parameter>]] { <test_class_item>}

Location

C++ Text Driver Script, TEST CLASS

Description

The TEST CLASS statement describes an object test class, which is one of the structuring entities of a C++ Test Driver Script. Test classes can appear at the root-level of a C++ Test Driver Script and in test classes.

<test class name> is a C++ Test Script Language identifier.

<formal parameter> is a C++ Test Script Language identifier. It has no type: it is replaced into the test class by an actual parameter. Thus it can refer to a C++ type as well a C++ constant or a C++ variable.

<actual parameter> is a C++ actual parameter.

<parent class> is a valid test class that is defined in the same scope that contains the TEST CLASS. All entities of a parent class are inherited. This mean that they are available just as if they were defined in <test class name> itself. The entities defined in the current test class with the same name as in the parent class are said to override, or replace, the entities defined in the parent class.

<test class item> may be one of the following entities:

A test class scope has no order, so these entities can appear in any order. However ON ERROR, EPILOGUE, PROLOGUE, and RUN may appear only once. The execution of a TEST CLASS without a RUN statement will execute the class' PROLOGUE and EPILOGUE only.

Example

TEST CLASS AdvancedTest (T) : BasicTest
{

  PROLOGUE {
       #Stack s (20);

  }

  PROPERTY Initial { (s.count == 0) }

  PROPERTY Final { (s.count == 1) }
      TEST CASE tc1 {

       CHECK PROPERTY Initial;

       #s.push (1);

CHECK PROPERTY Final;

}

RUN {

       tc1;

}

}