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" />
Regards, Avander
heidt.heidt wrote:
>
> This works for me:
>
> step.getWebtestProperty('scriptStartTime',step.PROPERTY_TYPE_ANT)
>
> The PROPERTY_TYPE_ANT is very important...
>
> ...
>
> If you are not the intended addressee, please inform us immediately that
> you have received this e-mail in error, and delete it. We thank you for
> your cooperation.
>
--
View this message in context:
http://www.nabble.com/howto-access-properties-in-Groovy-script--tp20129382p20129749.html
Sent from the WebTest mailing list archive at Nabble.com.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest