| 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
_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to