[Webtest] Groovy Step (XML/Groovy)

Dierk König Dierk König
Fri, 25 Jul 2008 21:57:23 +0200 (CEST)


Well, if you have a groovy step inside a Groovy webtest,
you have to provide the Groovy code as a String (or even
better in an external file, which I would recommend):

 		    groovy '''
 				print 'methods of step:'
 				print step.class.methods.name
 		    '''

cheers
Dierk

| -----Original Message-----
| From: webtest-admin@lists.canoo.com 
| [mailto:webtest-admin@lists.canoo.com] On Behalf Of Pfau, Matthias
| Sent: Freitag, 25. Juli 2008 16:57
| To: webtest@lists.canoo.com
| Subject: [Webtest] Groovy Step (XML/Groovy)
| 
| Hi,
| after a few hours I finally gave up. I simply do not 
| understand why one testcase works as XML and not as 
| Groovy-Code. The XML looks like:
| 	<?xml version="1.0"?>
| 	
| 	<!DOCTYPE project SYSTEM "../dtd/Project.dtd">
| 	
| 	<project default="test">
| 	 <target name="test">
| 	
| 	  <webtest name="check the groovy evaluation">
| 	    <groovy>
| 			print 'methods of step:'
| 			print step.class.methods.name    
| 	    </groovy>
| 	  </webtest>
| 	
| 	 </target>
| 	</project>
| 
| The Groovy-Code looks like:
| 	import com.canoo.webtest.WebtestCase
| 	
| 	class SimpleTest extends WebtestCase {
| 	  void testWebtestOnGoogle() {
| 	    webtest("check Groovy evaluation") {
| 		    groovy {
| 				print 'methods of step:'
| 				print step.class.methods.name
| 		    }
| 	    }
| 	  }
| 	}
| 
| Exception: 
| 	
| testWebtestOnGoogle(SimpleTest)groovy.lang.MissingPropertyExce
ption: No such property: step for class: SimpleTest
| 
| I tested against the latest build. Any ideas what went wrong?
| 
| Kind Regards
| Matthias
| _______________________________________________
| WebTest mailing list
| WebTest@lists.canoo.com
| http://lists.canoo.com/mailman/listinfo/webtest
|