Files and classes under test

Component Testing for C++

Source Files

The Source under test are source files containing the code you want to test. These files must contain either the definition of the classes targeted by the test, or method implementations of those classes.

Note Source files can be either body files (.C, .cc, .cpp...) or header files (.h), but it is usually recommended to select the body file. Specifying both header and body files as Source under test is unnecessary.

When using a C++ Test Driver Script, the wizard generates:

  • A template test driver script (.otd) to test each class defined in the Candidate classes box.

  • Declaration (.dcl) and stub (.stb) files to make the environment of the source under test available to the test script.

When using a C++ Contract Check script, the wizard generates:

  • A template contract script (.otc) containing template code allowing you to add invariants and state charts as well as empty wraps for each method of the class.

Note If a source under test is a header file (a file containing only declarations, typically a .h file), the source file under test is automatically included in the C++ Test Driver script.

Candidate Classes

For source files containing several classes, you may only want to submit a restricted number of classes to testing.

If no classes are selected, the wizard automatically selects all classes that are defined or implemented in the source(s) under test as follow:

  • The class is defined within the source file (i.e. the sequence class <name>{ .... }; ).

  • At least one of the methods of the class is defined within the source file (i.e. a method's body).

Note Classes can only be selected if you have refreshed the File View before running the Test Generation Wizard.

Related Topics

Additional Files or Directories | Component Testing Wizard