Web script generation rules are a powerful way of making a generated web script more flexible. For example, the Replace Key Value rule enables you to create a script that gets web form values from a data dictionary. This means that each virtual user (VU) in a test can supply different values to the same web page, getting those values from a data file.
When generating a virtual user script from a Web recording (using the Script Generation wizard), the script generator inserts code into the script for each HTTP request found in the recording.
Generation rules automatically modify the code that is inserted into the script.
Viewing Rules Applied to a Script After Generation
You can see the rules that were applied to a script after the script was generated by selecting the script in the Projects > Scripts view as show below:
Generation Rules and Custom Virtual Users
While some built-in rules are provided in the Base Web VU types, the user-defined generation rules are stored within a custom VU.
Your generated script can use any of the generation rules belonging to the custom VU on which the script is based, and any of the generation rules belonging to the custom VU's parent, all the way up to the Base VU.
You can see the generation rules belonging to a custom VU (and its ancestors) in the Virtual Users view by selecting the custom VU as shown below. You can also create and edit rules in this view. See Choose Script Generation Rules for more information about creating and editing rules, including information about how to use the assistant (the light bulb button.)
Generation Rule Availability During Script Generation
You also have the option in the Custom VU view to control whether or not rules are available during script generation. For example, you might want to make a rule unavailable during script generation if you know you will never use it in your workspace, or if you want to re-implement one of the base VU rules with your own functionality. The check boxes in the Available during script generation column control availability. The rules are all selected and available by default. Deselect one or more rules to make them unavailable during script generation.