Canoo WebTest
上一篇 /
下一篇 2010-06-19 10:14:33
/ 个人分类:自动化测试
一、介绍
Canoo WebTest 是开源的
web应用的
自动化测试工具。
官方网页为:http://webtest.canoo.com/webtest/manual/WebTestHome.html
二、示例代码
Canoo WebTest 的测试脚本是基于XML格式的。
请看示例:
(一)XML格式的用例
(就是"Ant",很方便持续集成)
<
project default="
test">
<
target name="
test">
<
webtest name="
check that WebTest is Google's top 'WebTest' result">
<
invoke url="
http://www.google.com/ncr"
description="
Go to Google (in English)"/>
<
verifyTitle text="
Google" />
<
setInputField name="
q"
value="
WebTest" />
<
clickButton label="
I'm Feeling Lucky" />
<
verifyTitle text="
Canoo WebTest" />
</
webtest>
</
target>
</
project>
(二)Groovy代码
import com.canoo.webtest.WebtestCase
classSimpleTest
extendsWebtestCase {
voidtestWebtestOnGoogle() {
webtest("
check that WebTest is Google's top
'WebTest' result") {
invoke "
http://www.google.com/ncr",
description: "
Go to Google (in English)"
verifyTitle "
Google"
setInputField name: "
q", value: "
WebTest"
clickButton "
I'm Feeling Lucky"
verifyTitle "
Canoo WebTest"
}
}
}
三、TestCase编写入门
相信熟悉HTML 语法和类似Java 语言的人都能了解上述的示例代码。
每个 TestCase 都写在<webtest>元素里面。<webtest>标签定义了这个用例的名称,它所包含的标签内容就是Test Steps, 例如采取什么行动(invoke, clikeButton, setInputField, etc.)或者验证返回内容(verifyTitle)。
四、 Download & Install
1. Download
http://webtest.canoo.com/webtest/manual/Downloads.html
2. Install
http://webtest.canoo.com/webtest/manual/install.html
五、参考
(一)、Munual Overview
http://webtest.canoo.com/webtest/manual/manualOverview.html
(二)、Samples
http://webtest.canoo.com/webtest/manual/samples.html
(三)、Properties
http://webtest.canoo.com/webtest/manual/properties.html
(四)、Syntax Reference
1. General Steps
http://webtest.canoo.com/webtest/manual/syntaxGeneral.html
2. Core Steps
http://webtest.canoo.com/webtest/manual/syntaxCore.html
3. Extension Steps
http://webtest.canoo.com/webtest/manual/syntaxExtension.html
4. Filter Steps
http://webtest.canoo.com/webtest/manual/syntaxFilter.html
5. PDF Steps
http://webtest.canoo.com/webtest/manual/syntaxPDF.html
6. Excel Steps
http://webtest.canoo.com/webtest/manual/syntaxExcel.html
7. Email Steps
http://webtest.canoo.com/webtest/manual/syntaxEmail.html
(五)、Groovy Testing
http://webtest.canoo.com/webtest/manual/groovyTesting.html
收藏
举报
TAG: