1. 程式人生 > >巧用Loadrunner自動關聯

巧用Loadrunner自動關聯

今日錄製指令碼學習關聯操作,費了一天半腦筋使用手動關聯,都沒有成功。因為早就在網上看到說自動關聯不靠譜,而且每次進行關聯也都是用手動關聯,所以這次壓根沒想到用自動關聯。就在我用手動關聯無數次失敗想要放棄的時候無意中使用了一次自動關聯,竟然成功了,甚感驚喜,所以把它作為我部落格的第一篇文章。

按照手動關聯步驟,去response尋找關聯值得左右邊界值,手動編寫關聯函式,但是回放時一直報錯,如下:

Action.c(36): Error -26377: No match found for the requested parameter "tid". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes, use web_set_max_html_param_len to increase the parameter size   [MsgId: MERR-26377]
Action.c(36): web_url("forum.php_3") highest severity level was "ERROR", 85561 body bytes, 16333 header bytes   [MsgId: MMSG-26388]
指令碼中tid較多,所以一直出錯。於是我先用自動關聯將tid關聯,如下函式:

web_reg_save_param_ex(
 "ParamName=CorrelationParameter_1",
 "LB=tid=",
 "RB=&extra",
 SEARCH_FILTERS,
 "Scope=Headers",
 "RequestUrl=*/forum.php*",
 LAST);

但是回放時仍報錯,此時關聯函式的左右邊界和位置肯定沒問題了,於是我換個函式編寫,如下:

 web_reg_save_param("tid",
  "LB=tid=",
  "RB=&extra",
  LAST);

以此函式來替代上述函式,結果竟然成功了。不過以後還是以此方法多多練習才能驗證是否每一次都好使。