首页 | 互联网 | IT动态 | IT培训 | Cisco | Windows | Linux | Java | .Net | Oracle | 软件测试 | C/C++ | 嵌入式开发 | 存储世界 | 服务器
网络设备 | IDC | 安全 | 求职招聘 | 数字网校 | 网页设计 | 平面设计 | 技术专题 | 电子书下载 | 教学视频 | 源码下载 | 搜索 | 博客 | 论坛
中国IT实验室软件测试频道
Google
首页 资讯动态 测试技术 测试工具 行业软件测试 测试管理 测试下载 经验分享 软件质量 其他技术 RSS订阅 博客 论坛
您现在的位置: 中国IT实验室 >> 软件测试 >> 测试工具 >> Robot >> 正文

用Rational Robot测试有数据关联的Web应用

  列表6中定义的一系列函数可根据一个字符串的包围字符串、前缀或者后缀进行抽取。它们的名字暗示了其各自的功能。例如,假设列表2中的HTML内容被保存在系统变量“_response”中,那么通过调用getStringByBoundaries(_response, “action=\”“, ”\“”)可以得到字符串“/search”;或者,也可以通过调用getStringByPrefixAndBoundary(_response, “/sea”, “\” name“)、getStringByBoundaryAndPostfix(_response, ”action=\“”, “ch”)或getStringByPrefixAndPostfix(_response, “/sea”, “ch”)来得到。这些函数也有相应的支持正则表达式的版本。

列表6. 一系列字符串抽取函数
string func getStringByBoundaries(source3, b1, b2)
string source3, b1, b2;
{
    int startPos, endPos;
    startPos = strstr(source3, b1);
    if (0 == startPos) {
        return "";
    }
startPos += strlen(b1);
endPos = strstr(substr(source3,
startPos, strlen(source3)), b2); if (0 == endPos) { return ""; } return substr(source3, startPos, endPos - 1); } string func getStringByPrefixAndBoundary(source4,
prefix, b3) string source4, prefix, b3; { int startPos2, endPos2; startPos2 = strstr(source4, prefix); if (0 == startPos2) { return ""; } endPos2 = strstr(
substr(source4, startPos2 + strlen(prefix),
strlen(source4)), b3); if (0 == endPos2) { return ""; } return substr(source4, startPos2,
strlen(prefix) + endPos2 - 1); } string func getStringByBoundaryAndPostfix(source5,
b4, postfix) string source5, b4, postfix; { int startPos3, endPos3; startPos3 = strstr(source5, b4); if (0 == startPos3) { return ""; } startPos3 += strlen(b4); endPos3 = strstr( substr(source5, startPos3, strlen(source5)),
postfix); if (0 == endPos3) { return ""; } return substr(source5, startPos3, strlen(postfix) + endPos3 - 1); } string func getStringByPrefixAndPostfix(source6,
prefix2, postfix2) string source6, prefix2, postfix2; { int startPos4, endPos4; startPos4 = strstr(source6, prefix2); if (0 == startPos4) { return ""; } endPos4 = strstr( substr(source6, startPos4 + strlen(prefix2),
strlen(source6)), postfix2); if (0 == endPos4) { return ""; } return substr(source6, startPos4, strlen(prefix2) + strlen(postfix2) + endPos4 - 1); }

 

上一页  [1] [2] [3] [4] [5] [6] [7] 下一页

【责编:michael】

中国IT教育

相关产品和培训
文章评论
 专题推荐

 ·建立可全面监控Squid代理服务器
 ·华为认证题库、模拟器下载专题
 ·嵌入式操作系统Linux资料下载(A)
 ·JAVA的应用编程接口——JAVA API详解…
 ·Linux Shell学习技术专题[上]…
 ·windows Server 2008专区…
 ·WEB开发ASP.NET和PHP、JSP究竟学哪个
 ·五步带你入门XML
 ·零距离接触OCP_Oracle认证体系全攻略
 ·揭秘:网络工程师职业发展路线图
 最近更新
 博客论点
 频道精选
 软件测试频道导航