This topic explains how to create and run a test executable, then review results in the C++test GUI.

Sections include:

Generating Tests

To generate test cases:

  1. Run your preferred test generation Test Configuration (for example, choose Parasoft> Test Using> Built-in> Unit Testing> Generate Unit Tests).

Building the Test Executable

For most supported targets/platforms, the process of building the Test Executable is just a part of an appropriate "Run..."-like Test Flow.

There are few cases where it's convenient to have a separate "Build..."-like Test Configuration and the associated Test Flow. It's generally best to follow the suggested strategy for your platform. For platforms where the full "build, run, read results" flow is normally provided, use the separate build Test Configurations only in special cases—for example, when automatic executable-to-target loading isn't supported, or when you need only the static coverage data (data collected while building the test executable—without execution).

Such Test Configurations may be created by extracting the build-portions from the original Test Flows of the original Test Configuration or user-adjusted Test Configurations. In many cases, you need to adjust one of the provided builtin Test Configurations to make it work for you—creating a new user configuration. In other cases, you can just use the builtin original Test Configuration.

There are several ways to build the test executable:

Information on the Test Flow and its adjustment can be found in  Customizing the Test Execution Flow.

Important Instrumentation Setting Considerations

Build process and subsequent execution are strongly affected by the instrumentation features accessible on the "Test Configurations> Execution" tab (see Fine-Tuning Test Settings for details. In embedded solutions, it's often convenient—or even required—to disable instrumentation of specific sources (for instance, containing startup code or interrupt-handling code). This may be achieved through the "Parasoft> C++test> Execution Settings..." context menu (right-click) action, which is available in the project tree; see Execution (File-Level Only) for details.

Running the Test Executable and Reviewing Results

If your test execution flow does not automatically deploy the test executable to the target device, start it, and/or read and display results in the GUI, you need to complete the necessary actions manually.

Tips for reading and displaying results via the file communication channel:

Tips for Reading and Displaying Results via the Socket Communication Channel

"Cannot find test log file. ...failed"  Message

If you receive this message, it may mean that 1) the test executable did not run correctly or 2) Test log files were not available in the expected location. In the latter case, the log files need to be transferred to the expected location OR the expected location needs to be changed to match the actual location.

Debugging Test Cases

Debugging in Various Embedded Development Environments

For some embedded environments, you can debug test cases directly in C++test. There are two modes for debugging test cases: 1) Internal mode and 2) External Embedded mode. For environments that C++test does not directly support test case debugging, you must exploit debugging methods for externally built executables provided by your environment (if available) and manually set breakpoints on wanted test cases. Check environment-specific chapters to see if C++test directly supports Test Cases debugging for your environment.

We strongly recommend using the built-in Test Configurations for particular embedded environments and making adjustments as necessary. See Executing Tests with a Debugger for instructions.

Enabling Internal Debugging Mode

  1. Make a duplicate of the environment-specific Test Configuration and select the duplicate from the User-defined folder.
  2. Choose the Execution> Runtime tabs and enable the Run tests in debugger(*) option.
  3. Make sure that the Use Eclipse internal debugger with configuration: option is enabled.

SeeDebugging in Eclipse Internal Debugger Mode, for additional information.

External Embedded Debugging Mode

You can switch to External Native mode by modifying the test configuration. This mode is only used for debugging native applications. After switching to External Native mode, you must also modify the Test Flow recipe to enable External Embedded debugging mode: 

  1. Make a duplicate of the environment-specific Test Configuration and select the duplicate from the User-defined folder.
  2. Choose the Execution> Runtime tabs and enable the Run tests in debugger(*) option.
  3. Enable the Use external debugger option. This enables External Native mode, which is only used for debugging native applications.
  4. Modify the Test Flow recipe to enable External Embedded. This mode can only be selected by modifying the Test Flow recipe. See Selecting External Embedded Debugging Mode, for instructions.