现在的位置: 首页 > 综合 > 正文

web_reg_save_param 和关联的使用(原创)

2012年09月15日 ⁄ 综合 ⁄ 共 1303字 ⁄ 字号 评论关闭
1. 作用:保存动态数据。该数据的来源为html源码。
2.使用
顺序:web_reg_save_param();
          web_submit_data();
          lr_message();
 自己在研究的时候,绕了个弯子,将这个顺序颠倒了。幸好在《中国软件测试论坛》中的xieannie网友帮助下搞明白了。在此,谢谢他的帮助!
3.web_reg_save_param()的 属性
1)在寻找动态数据时,可以对该数据的范围进行限制,通过左边界和右边界进行限制。即:LB,RB两个属性。

Portion of string to save to parameter

LB

RB

entire string

empty

empty

a string delimited by boundaries

boundary

boundary

the beginning of a string until the first right boundary

empty

boundary

the last left boundary until the end

boundary

empty

来源loadrunner帮助文档
其中LB/IC 是忽略字符的大小写。

2)ORD属性
是将找到的动态变量保存到数组中。默认是ord=1.如果搜索到的字符是多个,并想将他保存在数组里,则ord=all;他们分别保存到pr_1 pr_2 .....。其中pr_count为内部函数,统计数组的个数。

3)search 属性
设置搜索的范围,可以是header,body,header and body,html body。

4)SaveOffset属性
偏移量。从搜索到的字符串中,取子串。默认saveoffset=0.
5) SaveLen 属性
取串的长度。也是从搜索到的字符串中,取子串。

4.例子:
1)
char *pr

web_reg_save_param("pr","LB=pr","RB="<br>",LAST);
web_submit_data("pr.php
                          "url=http://"
                           "TargerFrame=" 
                            ......
                            LAST);
lr_message("value: %s",lr_eval_string("{pr}"));

然后你就可以在运行的log中看到结果。
2)关联的例子

char *pr

web_reg_save_param("pr","LB=pr","RB="<br>",LAST);
web_submit_data("pr.php
                          "url=http://"
                           "TargerFrame=" 
                            ......
                            LAST);

i=atoi(pr_count)

这个函数的作用还是蛮大的。希望能得到大家的关注。


抱歉!评论已关闭.