Canoo Webtest WebTest Canoo

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/> )! See this issue for an example.

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>

news

Latest build: development
Posted: 19-Jul-2016 17:36

WebTest 3.0 released, featuring upgrades to Java 5, Groovy 1.6, and HtmlUnit 2.4.
The release includes support for maven integration, IDE-integration like for unit tests, capturing of background JavaScript errors, new steps for mouseOver and mouseOut events, better parallel execution of tests and - as usual - lots of handling improvements.
Posted: 5 March 2009

WebTest @ JavaOne
Dierk König presented "Functional testing of web applications: scaling with Java" on Wed May 7, 13:30 at JavaOne 2008 in the Tools and Scripting Languages track.
Posted: 8 May 2008

New WebTest screencast available:
Data Driven WebTest
Posted: 13 November 2007

First WebTest screencast available:
Creating a first Webtest Project

Extend WebTest with Groovy! Groovy in Action is available in every good bookstore.
Groovy in Action
Posted: 29 January 2007