This topic explains how to create and share custom Test Configurations (and any rule files or rule mapping files that they depend on) across the team.
Every test run of C++test —whether it is performed in the GUI or from the command line interface—is based on a Test Configuration that defines a test scenario and sets all related test parameters (e.g., for static analysis, test execution, code review scanning, runtime error detection, and so on). To change how a test is performed, you can modify the settings for the Test Configuration that you plan to use. For example, to change the rules that are checked during static analysis, you modify the settings in the related static analysis Test Configuration.
C++test provides built-in Test Configurations that are based on a variety of popular test scenarios. However, because development projects and team priorities differ, custom Test Configurations are often desirable.
The default Test Configurations, which are in the Built-in category, cannot be modified. The recommended way to create a custom Test Configuration is to copy a Built-in Test Configuration to the User-defined category, then modify the copied Test Configuration to suit your preferences and environment. Alternatively, you could create a new Test Configuration "from scratch", then modify it as needed.
If C++test is connected to DTP, you can perform analysis with Test Configurations that are created and stored in your DTP server. Such configurations cannot be modified in your IDE, but they are configurable in DTP.
The Favorite Configuration should be set to the custom Test Configuration that you plan to use most frequently. By setting your preferred Test Configuration as the Favorite Configuration, you can easily run it from the Parasoft menu, the Test Using tool bar button, or from the command line interface.
To create a custom Test Configuration:
If a Test Configuration is "grayed out," this indicates that it was created with an incompatible C++test version, and cannot be edited or run with the current version.
If you are not using Parasoft Team Server to share test settings across your team, you can share custom Test Configurations with team members by exporting each Test Configuration that you want to share, then having your team members import it. See Importing/Exporting Test Configurations for details.
The Favorite Configuration defines the test scenario used by default when a test is run. For example, if a test is started by clicking the Run Tests button, C++test will run that test based on the parameters defined in the Favorite Configuration. In addition to settings the Test Configuration that is used as the default, you can also mark other commonly-used Test Configuration as your favorites; this configures easy access to them.
To indicate which Test Configuration you want to set as the Favorite Configuration:
The configuration will then be set as a Favorite Configuration; the "favorite" icon will be added to that configuration in the Test Configurations tree.
If desired, you can organize your user and team Test Configurations into user-defined subdirectories.
To move a user or team Test Configuration into a user-defined subdirectory:
The created subdirectory will be available in the Test Using directories.
The command line mode invocation is NOT affected by subdirectories. Here, you would continue to refer to the Test Configuration by only its name (without paths). For example:
-config "team://Policy Compliance"
Team Test Configurations are the Test Configurations that apply the team’s designated test settings (for instance, the static analysis rules that your team has decided to follow, the test generation settings you prefer to use, etc.). When all team members use the designated Test Configurations, code will be checked consistently, and the team’s quality and style guidelines will be applied consistently across the complete code base.
Once a team Test Configuration is added to Team Server, it will be accessible on all connected team C++test installations. If a Test Configuration uses custom rules and/or rulemappings, they can be added to Team Server, then automatically accessed by all connected team C++test installations.
To share a Team Test Configuration team-wide, the architect or manager performs the following procedure on a C++test installation that is already connected to Team Server:
You can configure multiple team Test Configurations (for instance, one for static analysis, one for unit test generation, one for regression testing, etc.).
Team Test Configurations can be directly edited from C++test.
The settings will then be updated on Team Server, and the updated settings will be shared across the team.
You can update a Team Test Configuration by modifying the User-Defined Test Configuration it was based on, then repeating the Deploying Test Configurations Across the Team procedure to re-upload the modified Test Configuration.
The Team Favorite Configuration defines the test scenario used by default when a Team Server-connected team member runs a test. For example, if a test is started by clicking the Test button, C++test will run that test based on the parameters defined in the Team Favorite Configuration.
To set the Team Favorite Test Configuration:
Rule mapping is a key part of configuring C++test to enforce your team’s or organization’s coding policy (e.g. by customizing the built-in rule names, severities, and categories to match the ones defined in your policy).
You can use Team Server to ensure that all team members can access the
rulemap.xml file you have created to customize Parasoft’s rule categories and severity levels. For details on how to create this file, see Modifying Rule Categories, IDs, Names, and Severity Levels).
To upload a
rulemap.xml file to the Team Server:
rulemap.xmlfile that you want to share.
rulemap.xmlfile that you created, then click Open. The
rulemap.xmlfile that you just uploaded should now be listed in the Browsing dialog’s Rules tab. The rule configurations specified in this file will be available on all C++test installations connected to Team Server.
You can use Team Server to ensure that all team members can access and check custom static analysis rules you have designed with the RuleWizard module. When Team Server manages a rule, all C++test installations connected to Team Server will automatically have access to the most recent version of the rule. If rule changes and the modified rule is uploaded to Team Server, the version on all team C++test installations will be updated automatically.
The architect (or other designated team member) performs the following procedure on one C++test that is already connected to Team Server:
.ruleextension. You can save the rule in any location.
.rulefiles that you created, then click Open. The
.rulefiles that you just uploaded should now be listed in the Browsing dialog’s Rules tab. All rules represented in this tab will be available on all C++test installations connected to Team Server.
Ensure that the modified Test Configuration available to the team as described in Deploying Test Configurations Across the Team. You must follow this procedure even if you are modifying a Test Configuration that is already shared.
To remove a rule from Team Server, the architect (or another designated team member) performs the following procedure from C++test:
If you want multiple Test Configurations to share some of the same parameter settings (for example, if you want multiple Test Configurations to have the same rules enabled), you can create new child Test Configurations referring to one parent Test Configuration. A child Test Configuration will inherit the parent’s settings; the value of each preference in the parent Test Configuration is used whenever the corresponding preference in the child Test Configuration is not present.
Inheritance is recursive; in other words, you could have the MyConfig2 Test Configuration inherit the settings from MyConfig1, and have MyConfig3 inherit the settings from MyConfig 2. MyConfig3 will thus inherit some MyConfig1 settings as it inherits MyConfig2 settings.
You can create a child Test Configuration from a Test Configuration shown in the Test Configuration panel, or by specifying a Test Configuration URL (for Test Configurations available via HTTP).
To create a child from a Test Configuration shown in the Test Configuration panel:
To create a child from a Test Configuration available via HTTP:
In the dialog that opens, enter the URL for the desired parent Test Configuration (http://config_address). For example:
To disconnect a child from its parent:
If you want to see the differences between two Test Configurations, you can compare them so that the differences are highlighted. For example, you might want to compare Test Configurations if:
To compare any two Test Configurations shown in the Test Configuration Manager
To compare a child Test Configuration with its parent:
To compare a child Test Configuration with its Quick Mode equivalent:
Changes will be highlighted in the comparison editor that opens.
Note that the comparison identifies both differences that are apparent within the panel (e.g., a setting is disabled in one Test Configuration and enabled in another) as well as deeper level differences (e.g., a rule is parameterized differently in one Test Configuration).
If you have created a Test Configuration that you want to share with team members or use in an upgraded version of C++test, you can export the Test Configuration into a properties file. That Test Configuration can then be added by importing the related properties file.
To export a Test Configuration:
A properties file will then be saved in the designated location. A dialog box will open to confirm the location of the newly-created properties file.
To import a Test Configuration that was previously exported into a properties file:
If C++test is connected to DTP, you can analyze your code according to Test Configurations that are stored on the DTP server you have specified (see ). Test Configurations in DTP cannot be modified in the IDE, but they can be configured in DTP.
To customize a DTP Test Configuration:
See the Test Configurations section in the Parasoft DTP Documentation for details.