Hi,

for groovy steps we use the groovy-step:

http://webtest.canoo.com/webtest/manual/groovy.html

there is a property:
replaceProperties which is default false!

mfg
Michael

A Vander schrieb:
Thanks it works for me too :-)). Why didn't I think of that 'curse'...

Here's the final script, hope it helps someone:
<scriptStep description="create a date property between birthday and
birthday+5" language="groovy">
        import java.text.SimpleDateFormat
        import java.util.Calendar
// get a handle to the properties
        def props = step.webtestProperties
        
        // store property in string ( the PROPERTY_TYPE_ANT is very important!)
        def bd = step.getWebtestProperty( 'de.bbp.datenaissance',
step.PROPERTY_TYPE_ANT)
// convert string to Date
        def sdf = new SimpleDateFormat('dd/MM/yyyy')
        def dt = sdf.parse( bd)
// do Date + 4 years
        def cal = java.util.Calendar.getInstance()
    cal.setTime( dt)
cal.add( Calendar.YEAR, 4) // convert new Date to string
    def dd = sdf.format( cal.getTime())
// store new Date as property ( use #{} to acess it from webtest)
        props.putAt('date.tooYoung', dd)
</scriptStep>
<testInfo description="Back from groovy! gd2 = '#{date.tooYoung}'"
type="debug" />
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to