天天看點

web_reg_save_param 和關聯的使用(原創)

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)

這個函數的作用還是蠻大的。希望能得到大家的關注。

web_reg_save_param 和關聯的使用(原創)

轉載于:https://www.cnblogs.com/morebetter/archive/2005/04/13/136653.html