grails webtest plugin 2.0发布

1 view
Skip to first unread message

songwei

unread,
Dec 19, 2009, 10:47:56 AM12/19/09
to groo...@googlegroups.com

webtest plugin是用来对Web应用做功能测试的(参考这里)。

 

安装:grails install-plugin webtest

 

创建:

grails create-webtest

 

编写:

利用webTest编写的功能测试样例代码片断如下(用过Selenium的人对如下的代码一定不会觉得陌生)

class MydomainTest extends grails.util.WebTest {

    def testMydomainListNewDelete() {

            invoke(url:'mydomain')

            verifyText(text:'Home')

            verifyListPage(0)    // <- internal method call for extracting common steps

            clickLink(label:'New Mydomain')

            verifyText(text:'Create Mydomain')

            clickButton(label:'Create')

    // more …

}

 

 

运行:

grails run-webtest

 

Reply all
Reply to author
Forward
0 new messages