Rules created in RuleWizard must be saved to a location accessible to the code analysis execution tool and enabled accordingly. Saving and enabling rules varies depending on the series of Parasoft tools being used to execute the rules. In this section:
Saving and Enabling Rules for Parasoft Tools 10.x and Later
The 10.x series includes C++test, dotTEST, and Jtest DTP Engines, as well as the C++test Desktop.
- Choose File> Save or File> Save As and save the rule to the [INSTALL_DIR]\rules\user\ directory.
For Windows, you may need to save the rule to the following directory: [DOCUMENTS DIR]\Parasoft\[tool]\rules where [DOCUMENTS DIR] refers to the "My Documents" directory in Windows. - Enable the rule by adding it to a test configuration. Test configurations can be managed and executed locally or distributed from Parasoft Development Testing Platform (DTP) for local execution. See the documentation for the analysis tool and/or DTP documentation for details.
Saving and Enabling Rules for Parasoft Tools 9.x
The appropriate procedure for saving and enabling rules depends on if they are being used locally or if your team is sharing rules and rule settings through Parasoft Team Server. Team Server is a component in Parasoft DTP for sharing assets across 9.x tools.
Saving and Enabling Rules Without Team Server
- Choose File> Save or File> Save As to save the rule with a .rule file extension into the static analysis rule directory. For example:
- Jtest - <workspace_location>/.metadata/.plugins/com.parasoft.xtest.standards.eclipse.core.java/jrules
- SOAtest - <workpace_location>/.metadata/.plugins/com.parasoft.xtest.standards.eclipse.core.web/urules
- If you want to store rules in a different location, specify your preferred User Rules directory in the Parasoft Preferences panel of the code analysis execution tool:
- Choose Parasoft> Preferences and select Configurations.
- Enable the User Rules option and specify the preferred directory.
- Choose Parasoft> Test Configurations and choose the configuration that you want to implement the rule.
- Choose the Static> Rules Tree tab. If the new rule requires a new category, you must create it by editing the rule map file:
- Click Edit Rulemap and open the Categories tab.
- Click New and enter the category ID and description.
- Click OK to save the new category.
- Click Import and specify the rule(s) you want to import.
- Click OK and enable the rule in the test configuration.
- Click Apply to save changes.
Saving and Enabling rules with Team Server
After you create team rules and add the appropriate files to Team Sever, Team Server will make them available across the team. See the Team Server chapter of your code analysis tool documentation.
Adding Team Rules 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 applicable Parasoft product installations connected to Team Server will automatically have access to the most recent version of the rule. If a rule changes and the modified rule is uploaded to Team Server, the version on all of the team’s applicable Parasoft product installations will be updated automatically.
The architect (or other designated team member) performs the following procedure on one Parasoft product installation that is already connected to Team Server:
- Choose File> Save or File> Save As to save the rule with a .rule file extension in any location.
- If the new rule requires a new category, you must create it by editing the rule map file:
- Choose Parasoft> Test Configurations and choose the test configuration you want to implement the rule.
- Open the Static> Rules Tree tab and click Edit Rulemap.
- Open the Categories tab and click New.
- Enter the category ID and description and click OK to save the new category. Note the location of the rulemap file listed at the top of the dialog.
- Choose Parasoft> Explore> Team Server and open the Rules tab of the Browsing dialog.
- Click Upload and choose the new .rule file(s) that you created.
- 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 and choose the edited rulemap file. The file that you just uploaded should now be listed in the Browsing dialog’s Rules tab. This file will be available across the team (via Team Server). This file indicates how to categorize the team rules.
- Click OK when finished to close the Team Server browser and click Apply to save your changes.
- Choose Parasoft> Test Configurations and choose the test configuration you want to implement the rule.
- Open the Static> Rules Tree tab and 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 Test Configuration available to the team as described in the Team Server section of your analysis tool's documentation. 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.
Using Team Rules
The new rule should now be available across the team. To use the new team rules, perform the following procedure from any Parasoft installation that is connected to Team Server and can perform static analysis in the rule’s language:
- Open the Test Configurations dialog by choosing Parasoft> Test Configurations.
- Select any Test Configuration. The new rule should be available in all of the applicable product’s Test Configurations and classified under the assigned (new or existing) category.
- Ensure that the team rules are enabled for at least one Test Configuration. The added rules will be disabled by default, so you will need enable any rules that you want checked.
- Run the Test Configuration that is configured to enforce the rules.