Hmm, now I've worked out how to separate screens, I get the error

The <group> type doesn't support nested text data

If I delete the descriptions in ant.group, the test runs successfully.

I have Screen3Test.groovy and Common.groovy.  

In Common.groovy I have successfulScreen2(AntBuilder) which includes a call to 
successfulScreen1(AntBuilder) which includes a call to 
successfulLogin(AntBuilder). (All part of a webflow).

Screen3Test.groovy calls successfulScreen2(AntBuilder).

Am I abusing the framework ?

The alternative design would be to have Screen3Test.groovy calling 
successfulLogin, successfulScreen1, successfulScreen2.

Thanks for any pointers

Martin
 

-----Original Message-----
From: Dierk König [mailto:[EMAIL PROTECTED] 
Sent: 29 October 2008 12:28
To: [email protected]; Flower, Martin
Subject: RE: [Webtest] Modularising Test


 
| OK, I've got the following class working, now that I added ant.group 
| in the common method.  Is this solution correct, and as simple as 
| possible ?

It is correct.

| I think I would be happier if I
| understood why ant.group is necessary.
        
|  def verifyHomePage() {
|   ant.group {
|    verifyTitle "BBC NEWS | News Front Page"
|    }
|   }
| }

you can just as well write the method as

  def verifyHomePage() {
    ant.verifyTitle "BBC NEWS | News Front Page"
   }

However, using 'group' for reusable parts is a best practice. You will find 
that it makes your reports much more readable, especially when giving it a 
dynamic description:

  def verifyHomePage(String title) {
   ant.group(description:"Title must contain $title") {
    verifyTitle title
    }
   }

The reason for using 'ant.' in this scenario is that your webtest steps are 
really mehtod calls. These calls must be effected on the AntBuilder instance.
Note that nested method calls like those within the closure after 'ant.group' 
are resolved against 'ant'
as well. This makes using 'group' convenient in addition to the advantages 
listed above.

happy testing
Dierk


This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.


_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to