Hi, What version of the plugin are you using?
I think since 1.1.4 all calls should be delegated to AntBuilder automatically and you shouldn't need to prefix everything with ab. I normally refactor common code into a parent test case which seems to work well. cheers Lee 2009/7/24 David Koo <[email protected]> > Hi there, > > (My apologies if you receive this twice, I'm not sure if it sent the first > time since I had just joined the mailing list) > > > I'm trying to better organize & re-use my WebTests (which I'm writing in > Groovy with support from the Grails WebTest plugin). > > Currently, I'm able to to call a method in one webtest class from another > webtest class by passing the AntBuilder instance as follows: > > public class MyTest extends WebTest { > > def testSomething(){ > > def userTest = new UserTest() > userTest.login(ant) > } > } > > This is fine, but my issue is in writing the login() method which currently > looks like this: > > public class UserTest extends WebTest { > > def login(AntBuilder ab) { > ab.group(description: "login") { > ab.invoke "/path/to/something" > ab.verifyText "some text" > ab.invoke "/path/to/something/else" > ab.verifyText "some other text" > ..... > } > } > } > > My issue is that it's quite tedious to have to put "ab." in front of every > single step in my test. > > I read somewhere that you didn't need to specify the AntBuilder instance > inside a group so I tried doing that as follows but I got an exception > saying it couldn't invoke my test (when calling this method from > MyTest.testSomething() above): > > def login(AntBuilder ab) { > ab.group(description: "login") { > invoke "/path/to/something" > verifyText "some text" > invoke "/path/to/something/else" > verifyText "some other text" > } > } > > I'm wondering if there's another way to do this? Am I missing something? > > Thanks, > Dave > >

