如何做Web的功能性测试

如何做Web的功能性测试

web的测试工具有perl,java, perl有HTTP-WebTest, java有htmlunit,Latka,Canoo WebTest

htmlunit是从xunit来的,对与程序员自己的单元测试有用(白盒),对于(黑盒)没有什么用, Latka可以用来做(黑盒)功能性(functional)测试,HTTP-WebTest与可能与Latka差不多 Canoo WebTest也是用来做功能性测试,可以与ant集成,网址

结果:功能性测试用Latka或者HTTP-WebTest,Latka更好用, 单元测试用htmlunit或者Cactus,应该更多的用Cactus

 

[警告]警告

Latka好像不能用,可能不是很成熟,以后再用

 

HTTP-WebTest使用

它可以自动记住session

wtscript文件说明,见WebTest CookBook 可以在lib目录中查看sub param_types就可以找到所有的参数,也可以在cpan中找HTTP::WebTest::Plugin, webtest的POD文档

			参数名称有的可以是全局的,可以看SetRequest.pm模块
test_name中的变量
    url
    relative_urls
    method
    params
    auth
    proxies
    pauth
    user_agent
    http_headers
    handle_redirects
    timeout

global变量
	ignore_case   yesno
    text_forbid   list
    text_require  list
    reegex_forbid  list
    regex_require list
	output_ref
	fh_out
	mail
	mail_addresses
	mail_server
	mail_from
	mail_success_subject
	mail_failure_subject
	plugins
	
HTTP::WebTest::Plugin::Click   - 可以点击上面一个页面的button,link...	
HTTP::WebTest::Plugin::Cookies - Send and recieve cookies in tests
HTTP::WebTest::Plugin::Delay   - Pause before running test 
HTTP::WebTest::Plugin::Hooks - Provides callbacks called during test run 
HTTP::WebTest::Plugin::Loader - Loads external plugins 
HTTP::WebTest::Plugin::ResponseTimeTest - Tests for response time 
HTTP::WebTest::Plugin::SetRequest - Initializes HTTP request for web test 
HTTP::WebTest::Plugin::StatusTest - Checks the HTTP response status 
HTTP::WebTest::Plugin::TextMatchTest - Test the content of the HTTP response. 
HTTP::WebTest::ReportPlugin - Subclass for HTTP::WebTest report plugins. 	

 

例子见ts-web-test,在CVS中

[重要]重要

用HTTP::Proxy和HTTP::Recorder可以把操作记录下来,自己写应该Logger,可以生成Webtest的脚本 HTTP::Recorder好像有的问题,修改了运行!见self/tools/WebTestLogger

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值