CHECK METHOD

C++ Test Script Language

Syntax

CHECK METHOD <native routine signature>;

Location

TEST CASE

Description

The CHECK METHOD checks that a routine (function or class member) is called during the execution of the surrounding test case. If the routine is not called, an error is generated. Error-handling behavior is specified with the ON ERROR keyword.

Note   The use of CHECK METHOD requires instrumentation of the source code under test.

<native routine signature> refers to an existing routine.

If parameters are specified, their names may be omitted.

Only one CHECK METHOD referring to each routine may occur in each TEST CASE.

Note   When the CHECK METHOD statement is used in an .otd test script, the related source files are always instrumented even if they are displayed as not instrumented in Project Explorer.

Example

TEST SUITE A {

       TEST CASE 1 {

              CHECK METHOD IntArray::ModifyCell (int);

              #IntArray ia;

              #InitializeArray (ia); // this function calls IntArray::ModifyCell

              // ia is filled with random numbers

       }

       TEST CASE 2 {

              CHECK METHOD IntArray::ModifyCell; // you can omit parameters

              #IntArray ia;

              // IntArray::ModifyCell was not called => error

       }

}

RUN { A; }