Page tree

Skip to end of metadata
Go to start of metadata

This topic explains how to check custom requirements or tailor existing rules to your unique needs by either modifying built-in static analysis rules or by creating your own static analysis rules.
Sections include:

Customizing Parameterized Rules

Many rules are parameterized, meaning that you can customize the nature of the rules by modifying the available rule parameters. Many naming convention rules are parameterized so that you can specify the naming convention that you want to check. Other rules are parameterized so that you can control rule options such as the scope of checking or choose among different interpretations of the rule. Parameterized rules are marked with a special icon (a wizard hat with a radio button) in the Test Configurations dialog Static> Rules Tree tab:

If a rule is parameterized, its parameters are described in the rule’s description. To view a rule’s description, right-click the node that represents that rule, then choose View Rule Documentation from the shortcut menu. 

To edit a parameterized rule:

  1. Open the Test Configurations dialog by choosing Parasoft> Test Configurations or by choosing Test Configurations in the drop-down menu on the Test Using toolbar button.
  2. Open the Static> Rules Tree tab for any Test Configuration. The modified rule parameters will be applied to all Test Configurations, so it does not matter which Test Configuration you select in this step.
  3. Expand the rule’s category branch.
  4. Right-click the parameterized rule that you want to modify, then choose View/Change Rule Parameters from the shortcut menu.
  5. Modify the rule parameters in the dialog that opens.
  6. Click OK to save your changes.

About RuleWizard

RuleWizard (available in the Architect and Automation edition only) allows you to create custom static analysis rules. SOAtest can automatically enforce any valid rule created in RuleWizard. By creating and checking custom rules, teams can verify unique project and organizational requirements, as well as prevent their most common errors from recurring.

With RuleWizard, rules can be created graphically (by creating a flow-chart-like representation of the rule) or automatically (by providing code that demonstrates a sample rule violation). No coding or knowledge of the parser is required to write or modify a rule.


 

There are two ways to open RuleWizard:

  • Choose Parasoft> Launch RuleWizard.
  • Click the New button in the Test Configurations panel’s Static tab.

The RuleWizard GUI will then open. The RuleWizard User's Guide (accessible by choosing Parasoft> Help in the SOAtest GUI or Eclipse workbench, then opening the SOAtest RuleWizard User’s Guide book) contains information on how to modify, create, and enable custom rules. 

Customizing Built-In Rules with RuleWizard

With SOAtest Architect Edition and Automation Edition, you can use RuleWizard to customize any rule marked with the following wizard hat + wizard wand icon in the Test Configuration panel’s rules tree:



We strongly recommend that you leave the SOAtest built-in rules intact; rather than modify the built-in rules, duplicate them, then modify the duplicates.
To customize a built-in rule in RuleWizard:

  1. Open the Test Configurations dialog by choosing Parasoft> Test Configurations or by choosing Test Configurations in the drop-down menu on the Test Using toolbar button.
  2. Open the Static> Rules Tree tab for any Test Configuration.
  3. Right-click the rule you want to modify, then choose Duplicate from the shortcut menu. A duplicate rule node—with a file icon—will be added to the rules tree.
  4. Right-click the duplicate rule, then choose Edit Rule in RuleWizard from the shortcut menu.

The RuleWizard GUI will then open. The RuleWizard User's Guide (accessible by choosing Help> Documentation in the RuleWizard GUI) contains information on how to modify and save custom rules. Be sure to save the rule after you modify it, then enable it as described in the Configuring Test Configurations and Rules for Policies or  Using Custom Rules (For Teams Not Using Team Server) (if you will not be sharing custom rules with Team Server).

This procedure is the same across Parasoft Test family products. For details, see the Configuring Test Configurations and Rules for Policies.

Creating New Rules

You can easily create your own static analysis rules (or modify built-in rules) using the SOAtest RuleWizard module, a graphical rule creation and customization tool available in SOAtest (Architect edition) and SOAtest (Automation edition).

With RuleWizard, rules can be created graphically (by creating a flow-chart-like representation of the rule) or automatically (by providing code that demonstrates a sample rule violation). No coding or knowledge of the parser is required to write or modify a rule.

To open RuleWizard:

  • Choose Parasoft> Launch RuleWizard.

The RuleWizard GUI will then open. The RuleWizard User's Guide (accessible by choosing Help> Documentation in the RuleWizard GUI) contains information on how to modify, create, and save custom rules. 

Before you can check custom rules, you must configure SOAtest to import and check them. For details on how to configure SOAtest to recognize and check those rules, see the Configuring Test Configurations and Rules for Policies or Using Custom Rules (For Teams Not Using Team Server) (if you will not be sharing custom rules with Team Server).

Note on Rule IDs

 Each rule that you import into the tool must have a unique rule ID. You should not import multiple rules that have the same rule ID.

Using Custom Rules (For Teams Using Team Server)

See the Configuring Test Configurations and Rules for Policies.

Using Custom Rules (For Teams Not Using Team Server)

Before you can check custom coding rules that were designed in RuleWizard, you need to configure SOAtest to access and check those rules.

Note

The following procedure describes how to enable custom rules if you are not using Parasoft Team Server to share rules across the team. If you are using Team Server, follow the instructions in the Configuring Test Configurations and Rules for Policies.

To configure SOAtest to import and check custom rules if you are not using Team Server:

  1. Open the Test Configurations dialog by choosing Parasoft> Test Configurations or by choosing Parasoft> Test Configurations in the drop-down menu on the Test Using toolbar button.
  2. Select any Test Configurations category. The new rule(s) will be available in all available Test Configurations.
  3. Open the Static> Rules Tree tab.
  4. If any new rules should belong to a new category, create a new category as follows:
    1. Click the Edit Rulemap.button.
    2. Open the Categories tab.
    3. Click New. A new entry will be added to the category table.
    4. Enter a category ID and category description in the new entry. For instance, an organi-zation might choose to use ACME as the category ID and ACME INTERNAL RULES as the description.
    5. Click OK to save the new category.
  5. Click the Import button to the right of the rules tree. The Import RuleWizard rule dialog will open.
  6. Use the Import RuleWizard rule dialog to specify which rule(s) you want to import, and whether you want to overwrite existing rule files (if an imported rule file has the same name as an existing rule file).
  7. Click OK. The rule will be displayed under the assigned category and will be disabled by default.
  8. Enable the new rule(s) you want checked.
  9. Click either Apply or Close to commit the modified settings.
  • No labels