During a test, C++test will create test cases based on the criteria defined in the selected Test Configuration’s Generation tab.
The Generation tab has the following settings:
- Enable Unit Test Generation: Determines whether C++test generates test cases for code in the test scope. If this option is not checked, all other test generation parameters are irrelevant.
- Generate tests for code: Determines when tests are generated. See Common Test Generation Goals for help on choosing the appropriate settings. Available options include:
- Without test suites: Prompts C++test to generate tests for code that does not have any valid test suites. C++test searches for available test suites based on the criteria specified in the Execution> General tab.
- With out-of-date test suites: Prompts C++test to generate tests for code that has been modified since the time that the related tests suite was generated. Old tests will be overwritten.
- With up-to-date test suites: Prompts C++test to generate tests for code that has not been modified since the time that the related test suite was generated.
- Generate tests for function access level: Determines whether C++test generates tests for public/global functions, protected functions, and private functions.
- The Access to private members instrumentation option must be enabled in order to generate tests for protected functions or private functions. See Execution tab for details on this option, which is controlled by Execution> General> Instrumentationmode.
- Max. number of generated test cases (per function): Determines the maximum number of test cases that C++test will generate per function.
- Add test case description: Determines if generated test cases will have the description that you provided.
Test suite tab
- Test suite output file and layout: Determines the test suite’s file name, location, and granularity/layout. See Customizing Generation Options for details.
- When generating tests for code with an existing test suite: Determines how C++test handles new test cases that are generated for code with an existing test suite. The new test cases can either replace the existing test suite, or be integrated into it. See Common Test Generation Goals for help on choosing the appropriate settings. Available options include:
- Add tests for functions without tests: C++test will generate test cases for functions without tests. The existing tests will not be affected or modified.
- Add tests for all functions: C++test will generate test cases for all functions. The existing tests will not be affected or modified.
- Replace the existing test suite: C++test will generate test cases for all functions. The existing test suite will be removed and then replaced with the new one.
- When referencing tested file in test suite: Determines whether the CPPTEST_CONTEXT and CPPTEST_TEST_SUITE_INCLUDED_TO macros use the full project path or relative paths.
- In most cases, using full paths is recommended. Relative paths can be helpful in special cases, such as when you want to generate tests for code that is used in different locations, and you want to use the tests in multiple locations as well. For example, assume that you have source files for a library that can be used by many different projects, and you have some tests connected with that source code. In that case, no matter where that source code is placed in the projects, the connected tests should work with it (because no full paths are used).
Test case tab