Webtest WebTest GitHub Home

Properties

WebTest knows about two kinds of properties, ant properties and dynamic properties. You typically select which kind you want to store into using the propertyType attribute of the storeXXX steps or by setting a defaultpropertytype in your config. You select which kind you want to read from using the ${} or #{} syntax. This section explains additional details about these two kinds of properties.

Ant Properties

${} properties are normal ANT properties. Given ANT's philosophy of a declarative build process, these are normally immutable. I.e. once you set a property its value normally can't be changed. ANT property values are typically determined at the start of an ant target. They are available to both ANT tasks and WebTest steps.

Dynamic Properties

#{} properties are only available (currently) to webtest steps. They are dynamic - you can use the same property and set it to different things throughout your tests. #{} properties support very simple expressions and there is support for accessing scripting variables under special circumstances. Property values are determined at the moment of use.

Nested Properties Expansion

Contrary to normal Ant execution (see Ant's enhancement issue), nested properties are evaluated during the execution of a WebTest. This means for instance that something like ${myProp#{counter}} will be evaluated just like ${myProp1} if the current value of the dynamic property counter is 1. Both nested Ant properties and dynamic properties are evaluated.

Converting Properties

You can happily swap between them using storeProperty by setting the propertyType attribute to the appropriate value.

Examples showing property type conversion
<steps>
..
    <-- assumes defaultpropertytype not set in config -->
    <storeProperty
        description="convert dynamic to Ant"
        name="ant_prop"
        propertyType="ant"
        value="#{dyn_prop}"/>
    <storeProperty
        description="convert Ant to dynamic"
        name="dyn_prop"
        value="${ant_prop}"/>
    <storeProperty
        description="convert combination to dynamic"
        name="dyn_prop2"
        value="text_mixed_with_${ant_prop}_and_#{dyn_prop1}"/>
..
</steps>