A-A+

webinject的再改造

2008年11月25日 资源分享 暂无评论 阅读 1 次
 
 
 
WebInject是一个极其轻量级的测试工具,能自动化测试Web services和Web应用程序。我也写了两篇webinject的文章:webinject注意事项webinject支持中文的方法
在实际应用中还有一个问题,如果同一个域名有多台服务器提供服务,那么在建立testcase时就需要建立多个case,我修改了webinject的代码,使它能够接收额外的IP地址参数,然后使用这个参数替代case中指定的固定字符串:IPADDRESS。
我的nagios的命令定义是:
define command{
        command_name    webinject
        command_line    /usr/local/webinject/webinject.pl -H $HOSTADDRESS$ -c $ARG1$ $ARG2$ $ARG3$
       }
这里的$ARG1$ $ARG2$ $ARG3$是指:config_file,testcase_file和XPath,webinject的使用方法见webinject中文手册

testcase的例子:
<testcases repeat="1">
<case
     id="1"
     description1="Login-userhome"
     method="get"
     url="http://IPADDRESS"
     addheader="host: www.example.com"
     verifyresponsecode="200"
     verifypositive="关键字"
     errormessage="http://IPADDRESS does not contain 关键字"
/>
</testcases>

文件: webinject.rar
大小: 12KB
下载: 下载

给我留言

Copyright © 浩然东方 保留所有权利.   Theme  Ality 07032740

用户登录