Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space CPPTDESKDEV and version 10.4.2


  • Initialize global variables as test preconditions: Determines whether global variables are initialized. When this option is enabled, automatically-generated test cases will initialize related global variables as preconditions.
  • Use objects of derived classes: Determines whether objects of derived classes defined in the tested compilation unit should be used as input values. When this option is enabled, C++test will also use objects of such derived classes as primary test objects when testing methods of abstract classes.
  • Use heuristics for input values: Determines whether heuristics values should be used for input values.
  • Use non-public class members in pre/post-conditions: Determines whether non-public class members are used in pre/postconditions. For instance, it determines if C++test can use private constructors to create an object of a class type, use private fields in memberwise precondition initialization, or display values of private fields as outcomes in test case postconditions.
    • The Access to private members instrumentation option must be enabled in order to use non-public class members in pre/postconditions. See Execution tab for details on this option, which is controlled by Execution> General> Instrumentation mode.
  • Use null values for pointers: Determines whether C++test uses null values to initialize pointer objects in test case preconditions. If it is disabled, null pointers will not be used in automatically-generated test cases.
  • Use member-wise initialization for class/struct objects: Determines whether class/struct objects are initialized in preconditions by varying non-static member fields. In this case, an object is created by using the default constructor and assigning a value to each of the class/struct member fields.
  • Use factory functions: Configures C++test to use factory functions, which are described in in Using Factory Functions. If you want to use factory functions exclusively, also enable Do not use other initializers for types with factory functions.
  • Redirect stdin/stdout/stderr streams: Determines if C++test automatically inserts streams redirection code to auto-generated test cases (you can add some data to stdin and/or check stdout/err as post-conditions). The test case code will look something like:

    Code Block
       CppTest_StreamRedirect* _stdinStreamRedirect =
    CppTest_RedirectStdInput("some value");
       CppTest_StreamRedirect* _stdoutStreamRedirect =
       CppTest_StreamRedirect* _stderrStreamRedirect =
       /* Tested function call */
       /* Post-condition check */
       CPPTEST_POST_CONDITION_CSTR_N("stdout", (CppTest_StreamReadData(_stdoutStreamRedirect, 0) ), 256)
       CPPTEST_POST_CONDITION_CSTR_N("stderr", (CppTest_StreamReadData(_stderrStreamRedirect, 0) ), 256) 
  • Memory allocation for test objects: Determines whether objects are created on the stack or on the heap.
  • Buffer allocation size: Determines the number of elements that should be allocated when creating buffers of simple types (such as char or int) in preconditions.
  • Insert code to report test case inputs and outputs: Determines whether macros reporting values of test case inputs and outputs are inserted into automatically-generated test cases.
  • Insert code to report test case outcomes: Determines whether macros reporting test case outcomes (post-conditions) are inserted into automatically-generated test cases. Such macros can be later verified and automatically converted into assertions.
  • Test case outcomes display settings: Determines the maximum number of characters to display for string types and the display method for simple type pointers. For the latter, it allows you to specify whether C++test should display first element or a fixed number of bytes for the simple type pointer allocation.
  • Insert assertion templates: Determines whether (commented out) assertions are inserted into automatically-generated test cases.