Excluding resources from Unit Testing

brian_nucklesbrian_nuckles Posts: 7 admin
edited January 9 in C/C++test

Some users may not want certain resources or files included in the testing scope for their unit tests. These resources can be excluded to ensure that no extraneous data is present in the tests. To indicate which project resources should not be tested during Unit Test Execution follow the steps below for your Development Environment:

Eclipse

  1. In the project tree, right-click the project that contains the files that you want excluded and select Properties.
  2. In the new window, Select Parasoft >> Scope Settings from the shortcut menu.
  3. Select the resource(s) you want to skip by clicking the "Add Resources" button.
  4. Make a copy of the built-in test configuration "Run Unit Test"
  5. In the copied "Run Unit Test" test configuration, go to the Execution Tab -> General -> Execution Details -> Instrumentation Mode and click the "Edit" button.
  6. In the new window, uncheck the Coverage check box for Additional Sources.
    User-added image
  7. Save and run the test configuration. The resource will be excluded from testing.

Visual Studio

  1. In the Solution Explorer, right-click the project that contains the files you want to excluded and select Parasoft->Properties.
    User-added image
  2. In the new window, Select Scope Settings from the shortcut menu.
  3. Select the resource(s) you want to skip by clicking the "Add Resources" button.
    User-added image
  4. Make a copy of the built-in test configuration "Run Unit Test"
  5. In the copied "Run Unit Test" test configuration, go to the Execution Tab -> General -> Execution Details -> Instrumentation Mode and click the "Edit" button.
  6. In the new window, uncheck the Coverage check box for Additional Sources. (See #Disable Coverage)
  7. Save and run the test configuration. The resource will be excluded from testing.
Sign In or Register to comment.