Renaming Test Suites

Test suite files should not be renamed. Doing so could prevent C++test from identifying and running the test suite.

Renaming Test Cases

To rename a test case:

  1. In the project tree, locate the test suite file that contains the test case(s) you want to rename.
    • 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 Customizing Generation Options for details).
  2. Double-click the project tree node that represents the test suite file. The file will open in an editor.
  3. Modify the test suite header as shown in the following examples:
    • Test case registration section:
      • Before:
        CPPTEST_TEST(test_processData_123);
      • After:
        CPPTEST_TEST(test_processData_regression);
    • Test case declaration section:
      • Before:
        /* CPPTEST_TEST_CASE_DECLARATION test_processData_123 */
        void test_processData_123();
      • After:
        /* CPPTEST_TEST_CASE_DECLARATION test_processData_regression */
        void test_processData_regression();
  4. Modify the test suite definition as shown in the following examples:
    • Before:
      /* CPPTEST_TEST_CASE_BEGIN test_processData_123 */
      void TestSuite_processData_1::test_processData_123(){
      ...
      }
      /* CPPTEST_TEST_CASE_END test_processData_123 */
    • After:
      /* CPPTEST_TEST_CASE_BEGIN test_processData_regression */
      void TestSuite_processData_1::test_processData_regression(){
      ...
      }
      /* CPPTEST_TEST_CASE_END test_processData_regression */
  5. Save the modified file.

Updating Test Suites for a Renamed Source File

If the name of the tested file changes:

  1. In the project tree, locate the test suite file that contains the test case(s) you want to rename.
    • 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 Customizing Generation Options for details).
  2. Double-click the project tree node that represents the test suite file. The file will open in an editor.
  3. Modify the CPPTEST_CONTEXT and CPPTEST_TEST_SUITE_INCLUDED_TO macro values.
  4. Save the modified file.
  • No labels