During a test, C++test will execute generated and user-defined tests (or run the application with runtime coverage monitoring enabled) based on the parameters defined in the selected Test Configuration’s Execution tab
The Execution tab has the following settings:
The following table describes the Instrumentation features you can enable/disable for tested sources, additional sources, and test case sources:
C/C++ Code Coverage: Determines whether coverage information is tracked. Coverage instrumentation for "test case sources" (the standalone test suites) is needed for the inline functions from included headers. C++test never instruments test case functions for coverage.
Stack trace reporting: Determines whether stack trace callbacks are reported. If disabled, the reported stack trace will not show the exact lines being executed and will miss non-stubbed function calls.
Access to private members: Determines whether private members are used in test cases (for example, calling private functions, using private constructors to create objects, setting up private fields in test case preconditions, and checking values of private fields in postconditions).
Function stubs: Determines whether safe definitions (provided by C++test) and user-defined stubs are used in unit testing.
Rename main() function: Determines whether code that contains a "main()" function is tested. If enabled, C++test will rename this function during instrumentation. This is needed because C++test provides its own "main()" function that does test case execution. If this option is disabled and the code under test contains a "main()" function, there will be an error during the test executable linking phase caused by multiply-defined "main" symbols. When you are working in "Application Monitoring" mode, this mode should be left disabled."
Memory monitoring: Determines whether runtime error detection for memory-related problems is enabled.
Assembly Code Coverage: Determines whether assembly coverage information is tracked. See Assembly Code Coverage.
Select the Optimize coverage (Application Monitoring Only) option to enable special optimized coverage modes, which are described in the following table:
Option | Purpose |
---|---|
Coverage instrumentation> Size optimized | The memory buffers used by coverage instrumentation for storing metrics data are optimized to take the lowest possible amount of RAM. This mode is suitable for embedded devices withlimitedamount of memory. |
Coverage instrumentation> Speed optimized | The memory buffers used by code coverage instrumentation for storing metrics data are optimized to assure the lowest possible execution time overhead. This mode is suitable for measuring coverage on application withlowtolerance for additional execution time overhead. |
Enable data consistency check | This option enables additional algorithms for detecting coverage buffer corruptions. Enable this option if coverage buffer corruption is likely caused by faulty behavior in the application under test. Enabling this option imposes some additional execution time overhead. |
Enable initialization of the coverage memory buffer | This option enforces the initialization of memory buffers used by code coverage instrumentation. This option should be selected if your compiler does not initialize global and static variables to 0 before the program begins running (required by ISO C standard). This option is enabled automatically (and can not beunabled) if "Size optimized" coverage instrumentation mode and "Enable data consistency check" are enabled simultaneously. |
Enable enum data autogeneration: Determines whether enum data required by enumeration-related API macros is collected (see Handling Enum Values for details).
When you run a Test Configuration set to execute tests, C++test performs a series of actions which usually leads to the unit testing results being loaded into the C++test UI. These actions are defined in a test flow file, which is stored in XML format and saved as part of the Test Configuration, which makes it possible to share it across the team. C++test provides a default execution flow that is designed specifically for host-based testing. C++test also allows you to define a custom test flow which can include C++test internal actions or external utilities started as processes in the operating system. The default test flow can be modified by: • Customizing the parameters of existing steps - see Customizing the Test Execution Flow • Removing existing steps • Adding new steps To define a custom test flow: 1. Open the Test Configurations panel by choosing Parasoft> Test Configurations. 2. Select the Test Configuration that you plan to use for test execution. 3. Open the Execution> General tab. 4. Click the Edit button 5. Enter your modified test flow or adapt existing one • If you want to adapt an existing test flow, choose that test flow from the Available built-in test execution flow(s) box, then click Restore. The XML for that test flow will then be displayed, and can be edited as needed. 6. Click OK to save the modified file. |
Execution details> Quick execution mode: Configures C++test to be less strict when verifying whether the test executable subproducts are current (e.g., whether they have changed since the previous run).
"Quick execution mode" can be used to reduce the time required to prepare the test executable. Since C++test will be less strict when verifying whether the test executable subproducts are current, the test preparation phase is faster. In this mode, C++test assumes that the following have not been modified since the previous run: • Compiler and linker options. • Header files. • Stub configuration. We recommended using the quick execution mode as follows: 1. Create a "quick" execution Test Configuration by duplicating a Test Configuration with the "normal" mode, and then enabling the Quick execution mode checkbox. 2. Use the two Test Configurations as follows: • When running tests on the server machine (nightly tests), use the "normal" Test Configuration. • When running tests on the developer machine (daily work), use "quick" Test Configuration. Normal execution mode is required on the developer machine when: • Compiler / linker flags in the project have changed (e.g., a new macro definition was added to the compiler options or a new external library was added to the list of the linker flags). • One of the header files included by the tested source / test suite source / stubs source was modified. • A new user stub was added to the project. • A stub definition was removed from the project. • Coverage data needs to be reported. After you use the "normal" configuration to re-build the test-executable, you can return to the "quick" mode. |
${test_ext} - C++test specific extension of a test suite file (.cpp)
• ${project_loc} - The path to the Eclipse project location (the location that contains the .project file). Do not use this variable if your project has "linked" source folders—source files that do not actually live within your project location.• ${resource_loc} - The path to the specific project resource. For instance, ${resource_loc:/MyProject/linked_src_dir/source.cpp} will be resolved into C:\src\source.cpp. You can use this variable if your project has "linked" source folders—source files that do not actually live within your project location. For example: Do not use this variable if your project has "linked" source folders—source files that do not actually live within your project location.
Test suites must be available from the project tree.
This section specifies how C++test creates a list of original symbol definitions (e.g., for functions or global variable) that should be available (for example, in external libraries) when preparing a test executable.
${project_loc}
resolves to the path to theEclipseproject location(the location that contains the .project
file). You cannot use this variable if your project has "linked" source folders—source files that do not actually live within your project location.
${resource_loc}
resolves to the path to the specific project resource.For instance, ${resource_loc:/MyProject/linked_src_dir/source.cpp}
will be resolved into C:\src\source.cpp
.
${project_loc}/src/core/*
)This option determines if C++test aborts unit testing execution if any missing symbol is detected during symbols/stubs analysis.If unresolved symbols are reported, see Resolving Linker Errors from Unresolved Symbols for tips on how to resolve them.
• Debug directly in Eclipse IDE using configuration: Determines if C++test runs tests with a debugger directly in the Eclipse IDE (according to an Eclipse Debug Configuration you have configured). If you enable this option, you must also specify the Eclipse Debug Configuration you want to use.
Report unit test execution details: Determines whether unit test execution details should be reported from executed test cases. This includes values reported from the CPPTEST_REPORT macros.
- Include tasks details: Determines whether reported tasks (e.g. exceptions, failed assertions, outcomes) should be included in test case execution details.
- Include passed assertions details: Determines whether checked and passed assertions should be included in test case execution details.