Page tree

Versions Compared

Key

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

...

  1. Generate test cases as described in Generating Test Cases for Regression Testing and Exception Finding.
  2. (Optional) If you want to automatically-generate stubs for missing function and variable definitions, run the built-in "Generate Stubs" Test Configuration, or a custom Test Configuration that is based on it. This is not recommended for regularly-scheduled command line tests.
    • See Adding and Modifying Stubs for information on how stubs are generated, and instructions for customizing C++test’s stub generation.
  3. (Optional) If you want to check whether auto-generated stubs and tests are compliable before you execute the tests, perform a trial build by running the built-in "Build Test Executable"  Test Configuration, or a custom Test Configuration that is based on it. This is not recommended for regularly-scheduled command line tests.
  4. Start the test using the built-in "Run Unit Tests" Test Configuration, or a custom Test Configuration that is based on it.

    Tip

    Tip - Executing Tests from the Test Case Explorer

    You can execute tests directly from the Test Case Explorer (which can be opened by choosing Parasoft> Show View> Test Case Explorer). Just select the Test Case Explorer node(s) for resource(s) you want to test (projects, folders, test suites, or test cases), right-click the selection, then choose the desired test execution Test Configuration from the Test History or Test Using shortcut menu.

    Executed tests will be color-coded to indicate their results status. Failed tests will be marked in red. Passed tests will be marked in green.

  5. Review and respond to the test case execution results.
  6. (Optional) Fine-tune test execution settings as needed.
Info
iconfalse

Testing Template Functions

C++test performs unit testing of instantiated function templates and instantiated members of class templates.

See Support for Template Functions for details.

Info
iconfalse
titleCoverage details

To generate a detailed coverage report, ensure that the Generate detailed coverage report for [coverage metric] option is enabled in the selected test configuration BEFORE running the test case. Open your test configuration, go to Execution> Runtime and select the option.

Configuring Batch-Mode Regression Test Execution with cpptestcli

...

  1. Open the test configuration and choose the Execution> General tabs
  2. Enable the Unit Testing execution mode and click Edit in the Execution details section at the Instrumentation mode field.

 

 

 

 

 

 

 

 









Only the following features should be enabled in the Tested sources category:

...

The following examples illustrate how these modes differ in the way the stub function or method is invoked. 

 


Code Block
/* Original definition of function to be stubbed */
int Func(void)
{
     // Function body
 }
/* tested function definition */
int testedFunction(void)
{
     int val = Func ();
     /* tested function body */
     return val;
}

...

  1. Open the test configuration and choose the Execution>General tab
  2. Click Edit next to Instrumentation mode drop-down menu and enable the stubbing mode

 


Configuring the instrumentation settings in this way introduces some limitations:

...

  1. Open the Test Case Explorer View and double click a test suite
  2. Drag the desired stub file into the Additional Stub Files field
    Alternatively, you can browse for stub files by click the file browser button located to the right of Additional Stub Files field

 





















Test suite-specific stub files can also be added to the test suite without using the GUI by modifying the test suite file directly. To add a stub file to the test suite, open the test suite in a text/code editor and insert the following macro for each stub file. You can also use a root directory path to include all stubs from a given location.

...

  1. Enable the Perform early check for potential linker problems option in the Test Configuration’s Execution> Symbols tab (see Execution Tab Settings : - Defining How Tests are Executed for details).
  2. Rerun the test.

...

Using a Debugger During Test Execution

...