[Webtest] groovy-task ?

Michael Habbert Michael Habbert <Michael.Habbert@netpioneer.de>
Tue, 03 Apr 2007 11:48:51 +0200


Hi Webtester,

why the ... is the following groovy task not working?

----------
<groovy description="find the next working day for vacation" >
	def day = Calendar.getInstance()
	def weekday = day.get(Calendar.DAY_OF_WEEK)
	def sdf = new java.text.SimpleDateFormat("dd.MM.yyyy")
	switch ( weekday ) {
	case ( Calendar.SATURDAY ):
	  day.set(Calendar.DATE, 2)
	  println "hey we have saturday"
	  break;
	case ( Calendar.SUNDAY ):
	  day.set(Calendar.DATE, 1)
	  println "hey we have sunday"
	  break;
	default :
	  day.set(Calendar.DATE, 14)
	  println "hey we work to do"
	}
	step.setWebtestProperty ('webtest.rescal.today', sdf.format( day.getTime() ))
</groovy>

<echo message="what is today: ${webtest.rescal.today}" />
------------------------

on the comand-line I see:

[java]      [echo] what is today: 03.04.2007

but expected:

                                   17.04.2007

thanks for hints ...

-- 
Mit freundlichen Grüßen
------------------------------------------------------------------------
Michael Habbert