Hi Lee,

We're on 1.1.4.2 and still having this problem. We had the same problem with
0.6 as well.

We have tried parent test cases as well, but if we try to put all common
code into parent test cases, we'll probably end up with some massive parents
(or duplicating code into multiple parents).

Can you replicate this issue on your end? Should I file a JIRA for it?

Thanks again,
Dave

On Thu, Jul 23, 2009 at 7:57 PM, Lee Butts <[email protected]> wrote:

> 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
>>
>>
>

Reply via email to