Choose Script Generation Rules Page
Script generation rules are a powerful way to make generated virtual user (VU) scripts more flexible, by automatically changing the generated script code.
On the Choose which script generation rules to apply page of the Script Generation wizard, you specify the rules you want to apply to your script. In addition to applying rules, you can also add and edit rules here.
The rules listed here are all the rules stored in the custom VU you selected on the Choose a Custom Virtual User type page earlier in the wizard. Also listed are all the rules from that custom VU's ancestors, all the way up to the Base Virtual User. Note that the Base VU's rules can be applied, but cannot be edited or removed.
The selected rules do not modify the recording directly, but modify the generated script code for any HTTP requests in the recording that match the rule criteria.
To apply a rule, select the check box to the right of the rule you want in the Apply rule to recording column as shown above. To select or clear all of the custom virtual user rules, click the button located on the right side of the pane. Note that clicking this button only applies to rules associated with custom virtual users. The base virtual user rules do not change state.
If a rule is disabled and not selected as shown highlighted above, you can still edit it here but you cannot make it available. To make a rule available during script generation you must select it in the custom VU view. See Generation Rule Availability During Script Generation for information about making rules available during script generation.
Using the Assistant
The Generation Rules Assistant helps you determine if you need a replace or data correlation rule, based on the text that the user enters and where it appears in the recording.
Display the Assistant by doing one of the following:
- Select a custom VU and click Assistant (light bulb button), OR
- Select a rule and click Assistant.
When you click Assistant, the Script Generation Rules wizard opens to the Select a Web Recording page. Select the web recording you want and click Next. Then the Generation rules assistant page opens. For more information about the Assistant, see the Assistant Page in the Rules Generation Wizard.
Adding a rule
- Select the custom VU under which the new rule should be stored.
- Click Add (the green plus button) to launch the Generation Rules wizard, OR
- Click Assist (the light bulb button) to also launch the Generation Rules wizard.
The Generation Rules Wizard appears.
Editing a rule
- Select the rule.
- Click Edit, OR
- Click Assist to launch the Generation Rules wizard
The Generation Rules Wizard appears, with the selected rule's options already set.
You can change the values in the Generation Rules Wizard to modify the existing rule.
The Generation Rules Wizard uses information from the current recording to help you create the rule and understand how it applies.
Removing a rule
Select the rule.
Click Remove.
The rule is removed from the Custom Virtual User. This means that other scripts (of the same Custom Virtual User Type) will not be able to use the rule when they are generated or regenerated.
Modifying rule order
You can move rules up and down in the list by selecting a rule, and then clicking the Up or Down arrows.
Rules are applied from top to bottom in the list. Sometimes the order in which rules are applied makes a difference to the generated script. For example, if a Replace rule changes a value, then subsequent rules will see the changed value instead of the original.