Webtest WebTest GitHub Home

Core Step storeProperty

Description

Provides the ability to store a given value into a property. It supports both dynamic properties and traditional ant properties.

Using the eval attribute indicates that the property should be treated as numeric and any simple expressions within the value should be evaluated. Brackets '(' and ')' as well as mathematical operators '+', '-', '*', '/' and '%' are supported. The result is treated as a double but converted back to a string before being stored into the property.

Parameters

description
Required? no
The description of this test step.
eval
Required? no, default is false
A flag which determines if the value is to be treated as a mathematical expression to be evaluated.
file
Required? yes/no
The name of the file from which properties should be loaded. It is similar to Ant's <property file='...'/> with the difference that this task allows to define dynamic properties that can be overwritten.
name
Required? yes/no
The property name. Must be set if property is not set (unless file is used).
property
Required? no
The name of the property in which to store the retrieved value.
propertyType
Required? no, default is the "defaultPropertyType" as specified in the "config" element is used.
The type of the property in which to store the retrieve value. Either "ant" or "dynamic".
value
Required? yes/no
The property value. Must be set unless file is used.

Inline Text

The inline text is all the text between the start tag ( <storeProperty> ) and the end tag ( </storeProperty> ), including blanks, tabs or newlines. Using a pair of start/end tags ( <storeProperty> </storeProperty> ) has not the same behavior than the seemingly equivalent empty element tag ( <storeProperty/> ).

Required? no
An alternative to the attribute value.

Details

The following examples illustrate various expression calculations.

storePropertyEvalExamples
<webtest name="storePropertyEvalTest">
  <config .../>
  <steps>
    <-- steps which extract some values from the page ... -->
    <storeProperty description="setting MyName=7.0name="MyNamevalue="3+4eval="true" />
    <storeProperty name="tableSizevalue="#{tableWidth} * #{tableHeight}eval="true" />
    <storeProperty name="gstAmountvalue="#{totalAmount} / 11eval="true" />
    <storeProperty name="adjustedvalue="(#{orig} - 1) * (${fudgeFactor} + 1)eval="true" />
  </steps>
</webtest>