This topic explains how to configure the scope of analysis.
Modifying the Scope for a Test Configuration
By default, C/C++test analyzes the resources selected when the test configuration runs, but you can configure a narrower scope using the scope options available on the test configuration's Scope tab. See Scope Tab Settings: Defining What Code is Tested.
Modifying the Scope on the Project Level
You can configure the scope on the project level by excluding resources in the GUI (see Excluding Project Resources from Testing) or by using the
-include options when running analysis in the command line (see Testing from the Command Line Interface).
Defining File Filters Based on Source Control Data
You can restrict the scope of analysis to locally modified files or to files modified on the current working branch by setting up file filters based on source control data. This allows you to focus on identifying and fixing bugs introduced by your recent code changes before checking the code into your source control system or merging with the main development stream.
You can define file filters:
- In the GUI of a selected test configuration–see Scope Tab Settings: Defining What Code is Tested.
- By specifying advanced scope settings–see Configuring File Filters with Advanced Settings. The settings will apply to all test configurations and overwrite the scope options specified in a test configuration.
Before you configure file filters, ensure that connection to a supported source control system is properly configured.
Configuring File Filters with Advanced Settings
To configure file filters:
Create an advanced settings file that includes C/C++test's advanced scope settings. See Advanced Scope Settings for a complete list of available settings. The contents of the advanced settings file may resemble the following:
- Specify the path to the advanced settings. See Configuring an Advanced Settings File for details.
Advanced scope settings configured in the settings file apply to all test configurations and overwrite the scope options specified in a test configuration.
Advanced Scope Settings
|Checks only locally modified files.|
|Checks only files on the current working branch that differ from the reference branch. By default, the reference branch is the main integration stream, such as "master", "trunk", etc. You can specify a custom branch with |
Enables checking all files that belong to the same compilation unit as the file that has been modified. This applies to both source files and header files.
C/C++test cannot analyze header files directly. This option allows you to ensure that modified header files are analyzed, even if the source files that include them remain unchanged.