Extension Type parameterRef
Description
Pass a set of properties to a scenario.
This type allows you to select a set of properties by their name and pass them to an applet's scenario. The selection occurs with regular expression.
The type further maps the selected (ant or dynamic) property names to any scenario names. The scenario name can be set with regular expression's group.
Parameters
- name
- Required? yes
- The name of the parameter in the scenario.
- regex
- Required? yes
- A pattern to select properties to pass to the scenario.
- propertyType
- Required? no, default is The "defaultPropertyType" as specified in the "config" element is used.
- The kind of properties to include. Either "ant" or "dynamic".
Details
The following example illustrates how to use the type parameterRef.
Consider a web application that operates in a single session with many similar items, such as an ordering tool. The test stores in the ant properties item.name.0 , item.name.1 , item.name.2 , item.name.3 and item.count.0 , item.count.1 , item.count.2 , item.count.3 names and count of items to use to fill forms in the test. At some point, the web application calls an applet that shows the state of the order. Webtest must hence pass the six properties to the applet.
<parameterRef
regex="user.name.(\d+)"
name="name.\1"
propertyType="ant"
/>
<parameterRef
regex="user.count.(\d+)"
name="count.\1"
propertyType="ant"
/>
</appletRunner>
This example defines the two parameterRef that map ant properties to applet parameters. Their attribute regex defines a regular expression that match the words item.name. or item.count. followed by a group of digits. Their attribute name defines a pattern that starts with the words name. or count. and that ends with the first group of the regular expression, the digits.
The applet scenario receives then the eight properties name.0 ... name.3 and count.0 ... count.3, each one having the value of their corresping ant properties.
WebTestRecorder