Hi,
WebTest's steps are first collected before to get executed. Try to
change to something like this:
webtest("TC01_01_03") {
groovy {
db.execute '''
UPDATE xxx SET yyy = true;
}
'''
openPage()
verifyText text:"Expected text", description:"S1"
...
}
Cheers,
Marc.
--
Web: http://www.efficient-webtesting.com
Blog: http://mguillem.wordpress.com
Koch Beat wrote:
> Dear all
>
> I have written a Groovy script that updates a database, checks for
> certain information on a webpage, updates the database again and checks
> if the information on the webpage has changed:
>
> void test01_01_03() {
> def db = new groovy.sql.Sql(source)
>
> webtest("TC01_01_03") {
> db.execute '''
> UPDATE xxx SET yyy = true;
> '''
> openPage()
> verifyText text:"Expected text", description:"S1"
>
> db.execute """
> UPDATE xxx SET yyy = false;
> """
>
> openPage()
> verifyText text:"Different text", description:"S2"
> }
>
> def openPage() {
> ant.group {
> invoke url:"http://mypage.mysite.com <http://mypage.mysite.com/>",
> description: "Open the page";
> verifyTitle text:"Some title", description:"Verify title"
> clickLink href:"start.action", description:"Open the requested page"
> verifyTitle text:"Another title", description:"Verify title"
> }
> }
>
> My problem is that the second UPDATE statement somehow gets executed
> before the first openPage() method call and the opening of the page
> under test has finished. The consequence is that verifyText
> text:"Expected text" fails because the page actually contains "Different
> text". If I disable the second UPDATE and following statements, then the
> test passes.
>
> What is happening here, why is it happening and what can I do to avoid
> it? How can I prevent the second db.execute being executed until the
> first verifyText has executed? Thanks for any suggestions!
>
> Regards
> Beat
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest