This topic explains how you can focus your test suite on the test cases that are most important for your current goals and project phase. This is accomplished by removing test cases and/or disabling outcome checks that are not currently of concern to you.

Sections include:

Disabling Test Cases

If you do not want to use a test case at the current time, but think you might want to use it sometime in the future, you can disable it. Disabled test cases are not executed and their status is reported as "Test case execution disabled".

When a test case is disabled, its macros are changed as follows:

Macro for enabled test caseMacro for disabled test case
CPPTEST_TEST(testcasename)CPPTEST_TEST_DISABLED(testcasename)
CPPTEST_TEST_FAIL(testcasename)CPPTEST_TEST_FAIL_DISABLED(testcasename)
CPPTEST_TEST_EXCEPTION(testcasena me,ExcType)CPPTEST_TEST_EXCEPTION_DISABLED(testca sename,ExcType)
CPPTEST_TEST_ERROR(testcasename,E rrorCode)CPPTEST_TEST_ERROR_DISABLED(testcasena me,ErrorCode)

Test cases can be disabled (as well as later enabled)  from the Test Case Explorer or from the 

Class view

.

From the Test Case Explorer

To disable a test case from the Test Case Explorer.

  1. In the Test Case Explorer, select the resource(s) you want to disable. You can select folder(s), test suite(s), or test case(s).
  2. Right-click the selection, then choose Disable from the shortcut menu.

Disabled tests will be skipped during execution.

The Test Case Explorer’s filters can be used while enabling/disabling tests. If a test is “filtered out,” its status will not be modified.

If you later want to re-enable disabled test cases, right-click the related Test Case Explorer nodes, then choose Enable from the shortcut menu.

From the Code Editor

To disable a test case from the code editor:

  1. Open the source code for the test you want to disable. You can do this by double-clicking the related 

    Class view

    node.

    • By default, automatically-generated test classes are saved in the tests/autogenerated directory within the tested project.
    • To check or change where C++test is saving the test suite files, open the Test Configurations dialog, select the Test Configuration that was used for the test run that generated the tests, then review the value in the Generation> Test Suite tab’s Test suite output file and layout field (see Test suite tab for details).

  2. Right-click the related source code, then choose Parasoft> C++test> Test Suite> Disable Test Case(s).

You can later re-enable the test cases in the same manner (just choose Enable instead of Disable).

Disabling the Checking of Specific Test Case Outcomes

If you do not want to check a test case outcome right now, but think you might want to check it sometime in the future, you can add comments prevent C++test from checking it. If you later want to check that test case outcome, you can simply remove the comments:

To prevent the checking of a particular test case outcome:

  1. In the Quality Tasks view, right-click the Unverified Outcome for that test case.
  2. Choose Ignore Outcome from the shortcut menu. C++test will then comment out the source code for checking that outcome.

Alternatively, you could manually comment out the source code for checking that outcome.

If you later want to re-enable checking of a disabled outcome, remove the comments.

Deleting Test Cases

Test cases can be deleted from the Test Case Explorer, 

Class view

 or from the Quality Tasks view. To permanently delete one or more test cases from the Test Case Explorer:

  • Right-click the test case(s) you want to delete, then choose Delete.

To permanently delete one or more test cases from the 

Class view

:

  1. In the 

    Class view

    , select the test case(s) you want to delete.

    • By default, automatically-generated test classes are saved in the tests/autogenerated directory within the tested project.
    • To check or change where C++test is saving the test suite files, open the Test Configurations dialog, select the Test Configuration that was used for the test run that generated the tests, then review the value in the Generation> Test Suite tab’s Test suite output file and layout field (see Test suite tab for details).

  2. Choose C++test> Test Suite> Remove Test Case(s).

To permanently delete one or more test cases from the Quality Tasks view:

  1. Select the node(s) related to the test cases you want to delete. You can select:
    • Test case nodes
    • Violation nodes
    • Children of violation nodes (including stack trace items
  2. Right-click the selection, then choose Remove Test Case(s) from the shortcut menu.

Deleting Test Suites

Test suites can be deleted from the Test Case Explorer, 

Class view

 or from the Quality Tasks view. To permanently delete one or more test suites from the Test Case Explorer:

  • Right-click the test suite(s) you want to delete, then choose Delete.

To permanently delete an entire test suite from the 

Class view

:

  1. In the project tree, locate the test suite file that you want to delete.
    1. By default, automatically-generated test classes are saved in the tests/autogenerated directory within the tested project.
    2. To check  where C++test is saving the test suite files, open the Test Configurations dialog, select the Test Configuration that was used for the test run that generated the tests, then review the value in the Generation> Test Suite tab’s Test suite output file and layout field (see Test suite tab for details).
  2. Right-click the related test suite node, then choose 

    Remove

    .

  • No labels