Hi Florent, thank you for your quick reply! :)
I got a little different groovy setup compared to yours: public class TestSuite extends WebtestCase { void testPageLogin() { webtest("comment") { <...steps...> } } private void myMethod() { } } using the groovy step, I can't access methods from the classes' instance (myMethod). Accidentally I found out this working: // creating webtest property using groovy step property (name:"webTestPropertyID", value "myValue") // defining groovy variable accessing webtest property def groovyVar = "\${webTestPropertyID}" important is the escaped backslash, which prevents groovy from evaluating the expression. Best regards, Alessandro Florent Blondeau <fblond...@pingwy .com> To Sent by: webt...@gate4.canoo.com webtest-ad...@gat cc e4.canoo.com 14.04.2009 12:12 Subject Re: [Webtest] Copy WebTest property into groovy variable Please respond to webt...@gate4.can oo.com Hi Alessandro, You're right... Groovy's the best way to use webtest !! ;-) So, there's several possibilities : If you want to copy a Webtest property in a groovy variable in the script that launches the steps -> it's impossible you cannot write : ant.testSpec{ config{ // config here } steps{ invoke(url:"bla.com") storeXPath(xpath:"//my/x/p...@th]",value:"groovy_var") def variable = groovy_var } } because closures are executed at construction time and not at run-time but... you can intercept it at the end of the step by writing an ant step listener like : ant.getAntProject().taskFinished = {buildEvent -> def task = buildEvent.task if (task.taskType == 'storeXPath'){ def variable = task.dynamicProperties.groovy_var } } DynamicProperties is the way to exchange variables between Webtest and Groovy. You can easily add a Groovy Step like groovy(description:"a way to get variables from webtest",""" def document = step.context.currentResponse.documentElement def props = step.webtestProperties def variable = props.groovy_var //groovy_var is the one from the storeXPath //and you can rethrow a groovy variable into webtest def webtest_var = doSomethingWith(variable) props.putAt("webtest_var_from_groovy",webtest_var) """) and then use it in your steps : setSelectField(xpath:"id('anId')/opti...@value='#webtest_var_from_groovy']") Hope that helps Florent Pingwy 27, rue des arènes 49100 Angers alessandro.co...@de.pwc.com a écrit : Dear all, I'm developing testcases in groovy. Is there a way to copy webTest property values into a groovy variable? e.g. excelStoreCellValue( cell:"B4", property:"propertyCellB4", description:"Read cell value from B4" ) Verfying is simple: verifyProperty(property:"propertyCellB4", value:"Periode", description:"Check property" ) But how to copy? def myVariable = ???? Any ideas appreciated! :) Best regards, Alessandro _________________________________________________________________ Diese Information ist ausschliesslich fuer den Adressaten bestimmt und kann vertraulich oder gesetzlich geschuetzte Informationen enthalten. Wenn Sie nicht der bestimmungsgemaesse Adressat sind, unterrichten Sie bitte den Absender und vernichten Sie diese Mail. Anderen als dem bestimmungsgemaessen Adressaten ist es untersagt, diese E-Mail zu lesen, zu speichern, weiterzuleiten oder ihren Inhalt auf welche Weise auch immer zu verwenden. Wir verwenden aktuelle Virenschutzprogramme. Fuer Schaeden, die dem Empfaenger gleichwohl durch von uns zugesandte mit Viren befallene E-Mails entstehen, schliessen wir jede Haftung aus. * * * * * The information contained in this email is intended only for its addressee and may contain confidential and/or privileged information. If the reader of this email is not the intended recipient, you are hereby notified that reading, saving, distribution or use of the content of this email in any way is prohibited. If you have received this email in error, please notify the sender and delete the email. We use updated antivirus protection software. We do not accept any responsibility for damages caused anyhow by viruses transmitted via email.
<<inline: graycol.gif>>
<<inline: pic21543.gif>>
<<inline: ecblank.gif>>