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.
Sections include:
About Test Configurations
Every test run of C++test —both 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. You can perform testing with built-in test configurations shipped with C/C++test that are based a variety of popular test scenarios. Alternatively, you can create a custom test configuration by duplicating one of the built-in test configurations and modifying the duplicate, or by creating a new test configuration from scratch; see Creating a Custom Test Configuration. Test configurations that are created and stored on your DTP server can only be customized directly on DTP; see DTP Test Configurations.
For your convenience, you can configure a Favorite test configuration that you plan to use most frequently. The Favorite test configuration defines the default test scenario and can easily be run from the Parasoft menu, with the Test Using tool bar button, or from the command line interface; see Setting the Favorite Test Configuration.
Setting the Favorite Test Configuration
Setting a test configuration as Favorite makes it easily accessible in the Parasoft menu and the toolbar in your IDE to facilitate execution of your most frequent scenarios. In addition, the Favorite test configuration defines the default test scenario for command line execution.
You can specify more than one Favorite test configuration to configure easy access to test configurations you frequently use. C/C++test assumes that the test configuration with the highest position in the Favorite hierarchy is the default for command line use and for the Run Tests toolbar button.
To specify the Favorite test configuration:
- Choose Parasoft> Test Configurations from the IDE menu or Test Configurations from drop-down menu on the Run Tests toolbar button to open the Test Configurations panel.
- Right-click the test configuration you want to set as Favorite.
- Choose Set As Favorite from the context menu.
- Specify the position of the test configuration:
- F: indicates the highest priority and the default scenario; this test configuration will be marked with the 'F' icon
- 1-3: indicates the order in which the Favorite test configurations will appear in the GUI (Test Using buttons, the Run Tests button menu)
Creating a Custom Test Configuration
You cannot directly modify built-in test configurations shipped with C/C++test. To create a custom test configuration, duplicate an existing test configuration and modify the duplicate in the User-defined category.
Test configurations that are created and stored on your DTP server can only be customized directly on DTP.
To create a custom test configuration:
- Choose Parasoft> Test Configurations from the IDE menu or Test Configurations from drop-down menu on the Run Tests toolbar button to open the Test Configurations panel.
- Review the available test configurations and do one of the following:
- To create a custom test configuration based on an existing test configuration: select and right-click the existing test configuration, then choose Duplicate.
- To create a custom test configuration from scratch: click New.
- Select the new test configuration.
- Modify the settings as needed; see Configuring Test Configurations for information about settings available in each tab.
- (Optional) Set the Test Configuration as the Favorite test configuration; see Setting the Favorite Test Configuration.
- Click Apply.
- Click Close.
Deploying Test Configurations Across the Team
You can deploy test configurations across the team via DTP, a primary platform for sharing and configuring team configurations, via Team Server, or by manually exporting and then importing a test configuration.
DTP Test Configurations
If C/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 Connecting to DTP).
Test configurations that are created and stored on your DTP server can only be customized directly on DTP.
To customize a DTP test configuration:
- Choose Parasoft> Test Configurations from the IDE menu or Test Configurations from drop-down menu on the Run Tests toolbar button to open the Test Configurations panel.
- Select the DTP category to view test configurations that are available on your DTP.
- Click the test configuration you want to modify.
- Click the Configure in DTP link to open the Test Configuration page in your DTP interface.
See the Test Configurations section in the Parasoft DTP User Guide for details about adding, configuring, and managing test configurations on DTP.
Team Test Configurations
Team test configurations are the test configurations that apply the team-specific test settings (for example, a selected sub-set of static analysis or custom test generation settings). Executing the same test configurations across the team allows you to consistently analyze your code and ensure that the team’s quality and style guidelines are consistently applied across the code base.
Deploying Team Test Configurations
Once a team test configuration is added to Team Server, it is accessible from all connected team C/C++test installations. If the test configuration uses custom rules and/or rulemapping, they can be added to Team Server, then automatically accessed by all connected team C/C++test installations.
To share a team test configuration team-wide, the architect or manager performs the following procedure on a C/C++test installation that is already connected to Team Server:
- Create a user-defined Test Configuration that applies the designated team settings; see Creating a Custom Test Configuration.
- Choose Parasoft> Test Configurations to open the Test Configurations panel.
- Right-click the test configuration you want to upload.
- Choose Upload to Team Server from the context menu.
You can configure multiple team test configurations.
Modifying Team Test Configurations
Team test configurations can be directly edited in your IDE.
- Choose Parasoft> Test Configurations from the IDE menu or Test Configurations from drop-down menu on the Run Tests toolbar button to open the Test Configurations panel.
- Select Team> [your_team_test_configuration] in the left pane.
- Modify the settings as needed.
- Click either Apply or Close to commit the modified settings.
The settings will be updated on Team Server and shared across the team.
Alternatively, you can first update the custom test configuration your test configuration was based on, and the re-upload that test configuration to Team Server.
Setting the Team Favorite Test Configuration
Consider setting your team test configuration as the Favorite test configuration; see Setting the Favorite Test Configuration.
Deploying Custom Rule Mappings Across the Team
Rule mapping is a key part of configuring C/C++test to enforce your team’s or organization’s coding policy (for example, 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:
- Launch C/C++test from a machine from which you can access the
rulemap.xml
file that you want to share. - Choose Parasoft> Explore> Team Server to open the Browsing dialog.
- Open the Rules tab of the Browsing dialog.
- Click the Upload button to open the file chooser.
- Select the
rulemap.xml
file that you created, then click Open. Therulemap.xml
file that you just uploaded will now be listed in the Browsing dialog’s Rules tab. The rule configurations specified in this file will be available on all C/C++test installations connected to Team Server. - Click Done.
- Click Apply and close the Parasoft Preferences dialog.
- Restart the program. You do not have to stop the server first.
You can verify if the new rule setting are applied by in the Static tab of any test configuration.
Tip
If you later modify the master rulemap.xml
file, you must repeat the Deploying Custom Rule Mappings Across the Team procedure to upload the modified file; if the modified file is not uploaded, the modifications will not be shared.
Deploying Custom Rules Across the Team
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/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-C++test installations will be updated automatically.
The architect (or other designated team member) performs the following procedure on one C/C++test that is already connected to Team Server:
- Create one or more custom rules in RuleWizard.
- Save each rule and assign it a
.rule
extension. You can save the rule in any location. - If you want a new rule to belong to a new category, create a new category as follows:
- Choose Parasoft> Test Configurations from the IDE menu or Test Configurations from drop-down menu on the Run Tests toolbar button to open the Test Configurations panel.
- Select any test configuration.
- Open the Static> Rules Tree tab.
- Click the Edit Rulemap button.
- Open the Categories tab.
- Click New. A new entry will be added to the category table.
- Enter a category ID and category description in the new entry. For instance, an organization might choose to use ACME as the category ID and ACME INTERNAL RULES as the description.
- Note the location of the rulemap file, which is listed at the top of this dialog. You will need this information in step 9.
- Click OK to save the new category.
- Choose Parasoft> Explore> Team Server. The Browsing dialog will open.
- Open the Rules tab of the Browsing dialog.
- Click the Upload button. A file chooser will open.
- Select one or more of the new
.rule
files that you created, then click Open. The.rule
files 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. - Add additional team rules by repeating the previous two steps.
- If you added any new rule categories or made any other changes to the rule mappings, click Upload, select the edited rulemap file, then click Open. The file that you just uploaded should now be listed in the Browsing dialog’s Rules tab. This file will be available on the C/C++test installations that are connected to Team Server. This file controls how the team rules are categorized.
- Open the Test Configurations dialog by choosing Parasoft> Test Configurations.
- Select any test configuration and open the Static> Rules Tree tab.
- Click Reload. The new rule should be available in all available test configurations and classified under the Team category. The rule will be disabled by default.
- If you want a Team Test Configuration to check these rules:
- Configure a new or existing Test Configuration to check these rules. The added rules will be disabled by default, so you will need to enable any rules that you want checked.
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.
- Click either Apply or Close to commit the modified settings.
Tip
- If your custom rule is visible in Test Configuration rules tree (for instance, if you imported it via the rules tree Import button), you can upload it to Team Server by simply right-clicking the rule, then choosing Upload to Team Server from the shortcut menu.
- If you later modify a team rule, you must repeat the Deploying Custom Rules Across the Team procedure to upload the modified rule file; if the modified
.rule
file is not uploaded, the rule modifications will not be shared.
Removing Rules From Team Server
To remove a rule from Team Server, the architect (or another designated team member) performs the following procedure from C/C++test:
- Choose Parasoft> Explore> Team Server to open the browsing dialog.
- Open the Rules tab of the Browsing dialog.
- Select the rule you want to remove.
- Click Delete.
- Click Done.
Importing/Exporting Test Configurations
If you want to share a custom test configuration with other team members or use it in an upgraded version of C/C++test, you can export this test configuration to a .properties file that can then be imported by another team member(s).
Exporting
To export a test configuration:
- Choose Parasoft> Test Configurations from the IDE menu or Test Configurations from drop-down menu on the Run Tests toolbar button to open the Test Configurations panel.
- Right-click the test configuration you want to export.
- Choose Export from the context menu, then use the file chooser to indicate where you want to save the .properties file that will be created for this test configuration.
- Click Save. A dialog box will open to confirm the location of the newly created .properties file.
Importing
To import a test configuration from a .properties file:
- Choose Parasoft> Test Configurations from the IDE menu or Test Configurations from drop-down menu on the Run Tests toolbar button to open the Test Configurations panel.
- Right-click the User-defined category.
- Choose Import from the context menu to open a file chooser.
- Navigate to the .properties file of the test configuration you want to import.
- Click Open.
Test Configurations – Advanced Topics
Organizing User and Team Test Configurations into Subdirectories
You can organize your user and team test configurations into user-defined subdirectories.
To move a user or team test configuration to a user-defined subdirectory:
- Choose Parasoft> Test Configurations from the IDE menu or Test Configurations from drop-down menu on the Run Tests toolbar button to open the Test Configurations panel.
- Right-click the test configuration you want to move to a subdirectory.
- Choose Set Folder from the context menu.
- Specify the subdirectory or subdirectories and click OK. In the following example, the test configuration is moved to the 'Security' subdirectory:
Do NOT provide the path to the subdirectory in the command line mode. Subdirectories do not affect command line execution. In the above example, you can specify the following test configuration:
-config "team://Policy Compliance"
Specifying Test Configuration Inheritance
If you want multiple test configurations to share some 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 configured.
Inheritance is recursive. For example, if MyConfig2 test configuration inherits the settings from MyConfig1 and MyConfig3 inherits the settings from MyConfig 2, then MyConfig3 will inherits some MyConfig1 settings, because it inherits MyConfig2 settings.
You can create a child test configuration from a test configuration displayed in the test configuration panel, or by specifying the URL of the test configuration (if the test configurations is available via HTTP).
To create a child from a test configuration displayed in the test configuration panel:
- Open the Test Configurations panel.
- Right-click the desired parent Test Configuration.
- Choose New Child from the context menu.
To create a child from a test configuration available via HTTP:
- Open the Test Configurations panel.
- Right-click the User-Defined node.
- Choose New Child from the context menu.
In the dialog that opens, enter the URL for the desired parent Test Configuration (http://config_address). For example:
http://SOAtest.acme.com/configs/static.properties
To disconnect a child from its parent:
- Open the Test Configurations panel.
- Click the Disconnect button to the right of the Parent field.
Important Notes
- Once a parent-child relationship is set, that correlation cannot be modified. For example, if test configuration A is the parent of test configuration Z, you cannot switch test configuration Z’s parent to test configuration B.
- Once a child test configuration is disconnected from its parent, it cannot be reconnected. All the inherited settings are applied directly in the child when disconnected.
- A given test configuration may have only one parent configuration. Multiple inheritance is not supported.
Comparing Test Configurations Using the Test Configurations Panel
If you want to see the differences between two test configurations, you can compare them to highlight the differences. You may want to compare test configurations if:
- You customized a built-in static test configuration from a previous product version and want to verify what new rules have been added and enabled in the most current version of that built-in test configuration.
- You want to verify what settings will be affected if you run a given test configuration in "Quick Mode."
- You want to verify the differences between a child test configuration and its parent.
To compare any two test configurations displayed in the Test Configurations panel.
- Select two test configurations.
- Right-click the selection.
- Choose Compare.
To compare a child Test Configuration with its parent:
- Right-click the child test configuration.
- Choose Compare with> Parent Configuration.
To compare a child test configuration with the corresponding test configuration in the Quick Mode:
- Right-click the child test configuration.
- Choose Compare with> Quick Mode Configuration.
Changes will be highlighted in the comparison editor that opens.
Comparint test configurations allows you to identify both the differences that are apparent within the panel (for example, when a setting is disabled in one test configuration and enabled in the other), as well as differences on a lower lever, such as different rule parametrization.