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 ? I think
I would be happier if I understood why ant.group is necessary. Thanks. Martin.
import com.canoo.webtest.WebtestCase
import org.junit.Test
public class BBCHomePageTest extends WebtestCase {
void testOne() {
webtest("Test One") {
invoke url: "http://news.bbc.co.uk"
verifyHomePage()
}
}
void testTwo() {
webtest("Test Two") {
invoke url: "http://www.bbc.co.uk/news"
verifyHomePage()
}
}
void testThree() {
webtest("Test Three") {
invoke url: "http://www.bbc.co.uk/go/homepage/d/int/news/heading/-/news/"
verifyHomePage()
}
}
void testFour() {
webtest("Test Four") {
invoke url: "http://news.bbc.co.uk/1/hi/also_in_the_news/default.stm"
clickLink label: "News Front Page"
verifyHomePage()
}
}
def verifyHomePage() {
ant.group {
verifyTitle "BBC NEWS | News Front Page"
}
}
}
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dierk König
Sent: 29 October 2008 07:52
To: [email protected]
Subject: RE: [Webtest] Modularising Test
Hi Martin,
I don't quite understand your scenario.
The webtests that grails generate for you via the grails create-webtest
MyDomainClass command already contain an example of how to put reusable test
code into methods: 'verifyListSize'.
hope that helps
Dierk
| -----Original Message-----
| From: [EMAIL PROTECTED]
| [mailto:[EMAIL PROTECTED] On Behalf Of Flower, Martin
| Sent: Dienstag, 28. Oktober 2008 17:01
| To: [email protected]
| Subject: [Webtest] Modularising Test
|
| I've successfully created a single groovy test that steps through a
| seven page webflow. I haven't been able to work out how to reuse
| code.
| What I would like to do is :
|
| Test One {
| Login
| Page one
| Page two
| Page three
| }
|
| Test two {
| Login
| Page one
| Page two click logout
| }
|
| Test three {
| Login
| Page one
| Page two
| Page three click logout
| }
|
| The error I get is
|
| No current response available! Is previous invoke missing?
|
| It's clear that I need to pass the state around between the methods.
|
| I think what I really need is some more groovy examples of common ways
| of using the test tool. Can anyone recommend some links/blogs ?
|
| Thanks.
|
|
|
|
|
| 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
|
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
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