Create the "Run Unit Tests" Test Configuration

1. Choose Parasoft> Test Configurations.

2. Choose Built-in> Unit Testing and right-click the Run Unit Tests configuration

3. Choose Duplicate to copy the configuration to the User-defined category.

4. Select the new user-defined configuration and open the Execution> General tab.

5. Confirm that the Test execution flow settings is to Default host-based unit testing. The default instrumentation mode is set to full runtime instrumentation with line coverage only. Test suites will be used from the project tests directory and tests will be run from a single test executable.

6. Open the Symbols tab and confirm that the following settings are enabled or selected:

  • Library Symbols Identification mode is set to Automatic, which is appropriate for most situations.
  • Use symbols from additional project files is selected and set to include all project files (Project Scope).
  • Use extra symbols from files found in is set to the default locations. Any functionality provided by project object/library files will be used.
  • Perform early check for potential linker problems is disabled by default. Turning this on may provide additional information if you experience linking problems.

7. Open the Runtime tab and confirm the following settings:

  • Test executable run directory is set to ${cpptest:testware_loc}. This is the default setting where the "testware" location is defined. It is the working directory of the test executable. An option is available for running tests in a debugger.
  • Timeout for a single test case (in milliseconds) is 5000 (5 seconds). This is the default timeout for test cases that hang.
  • Report unit test execution details is enabled
  • Report unverified test case outcomes is enabled.

8. Rename the configuration Run Unit Tests (Project Scope).

9. Apply the changes made and close the Test Configurations window.

Only files that have test cases will be tested. We recommend focusing on individual files until you have completed an initial sweep, which makes working through possible issues easier. After each file has been tested once, you can select a set of files (or the entire project) and run tests together and move on to additional steps in the error detection process. In addition, the Test Case Explorer can be used to select test cases, test suites, or groupings of either and run the selected tests in the same manner as when selecting source files from the project tree.

Execute the Unit Test

1. In the project tree, select ATM.cxx as the test scope.

2. Choose Parasoft> Test Using> User-Defined> Run Unit Tests (Project Scope).

3. Review the Test Progress tab’s summary of the unit test execution. You can expand the scope and execution sections to view summary information on the code involved, test case results, and coverage results.

  • No labels