I have to do some arithmetic an a date property and store it in a new
property, a piece of cake for Groovy I think.
I found a nice example on this board and came up with following script:
<scriptStep description="create a date property '4 years later'"
language="groovy">
import java.text.SimpleDateFormat
import java.util.Calendar
// get a handle to the properties
//def props = project.webtestProperties
//def bd = props.get('de.bbp.datenaissance') // is null!
//println( 'bd from property: ' + bd)
bd = '01/01/1963'
// convert property to Date
def sdf = new SimpleDateFormat('dd/MM/yyyy')
def dt = sdf.parse( bd)
def cal = java.util.Calendar.getInstance()
cal.setTime( dt)
cal.add( Calendar.YEAR, 4)
def dd = sdf.format( cal.getTime())
// store computed property
props.putAt('date.tooYoung', dd)
</scriptStep>
Problem is that I can't get a the right input property. This property has
been created during the ant call to the webtest...
Any pointers? TIA
--
View this message in context:
http://www.nabble.com/howto-access-properties-in-Groovy-script--tp20129382p20129382.html
Sent from the WebTest mailing list archive at Nabble.com.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest