The Stubs view allows you to view the symbols and see where the functionality for the symbols is defined and located. The symbols data for the Stubs tab is not collected until a test configuration that collects stub information is executed.

  1. Open the Stubs view by choosing Parasoft> Show View> Stubs.
  2. Double-click the symbol to open its source code definition

Create a Test Configuration for Collecting Stub Information

  1. Open the Test Configurations window and duplicate Built-in> Unit Testing> Collect Stub Information.
  2. Select the new user-defined Test Configuration and open the Execution> General tab. Confirm that the Test execution flow field is set to Collect stub information.
  3. Open the Symbols tab and confirm the following settings:
    • Library Symbols Identification mode is set to Automatic. This setting is appropriate for most situations.
    • Use symbols from additional project files is selected and a wildcard is set to include all project files (Project Scope).
    • Use extra symbols from files found in is selected and ${cpptest:cfg_dir}/safestubs;${project_loc}/stubs;${project_loc}/factory (the default location) is entered.
  4. Rename the configuration Collect Stub Information (Project Scope).
  5. Apply the changes made and close the Test Configurations window. When you run the Collect Stub Information configuration, it is important to select the same test scope that you intend to run unit tests on.

Run the Stub Information Collection Configuration

  1. In the project tree, select ATM.cxx as the test scope.
  2. Choose Parasoft> Test Using> User-Defined> Collect Stub Information (Project Scope).
  3. Choose Parasoft> Show View> Stubs and open the Stubs tab. The original code is used for all function calls because there is no functionality missing from the project.



Collect Stub Information (File Scope vs Project Scope)

  1. Choose Parasoft> Test Configurations to open the Test Configuration dialog.
  2. Duplicate Built-in> Unit Testing> File Scope> Collect Stub Information (File Scope). A file scope configuration must be set up to isolate, test and collect stub information form a single file (ATM.cxx file).
  3. Open the  Execution tab and click the Symbols tab.
  4. Disable the Use symbols from additional project files option.
  5. Apply the change and close the Test Configurations window.
  6. Select ATM.cxx in the project tree, run the new user-defined test configuration, and review results as above with Project Scope.


Stubs will need to be generated for the missing functionality. This will be covered the next exercises.

  • No labels