LB和RB Boundaries中的web_reg_save_param()是否有正则表达式?

时间:2015-10-09 14:48:42

标签: testing performance-testing loadrunner vugen

功能:

web_reg_save_param("questionId", "LB=secretKnowledges\":\\[\\{", "RB=\"", LAST);

我尝试捕获来自服务器响应的“questionId”参数的值作为(json文件)并且看起来如此:

"salutation":{"firstNaAction me":"Sebastian","lastName":"Martens"},"userAccount":{"mail":"gcdmtest_bp_pr_acc_po_20073@trash-mail.com","notificationLevel":"NEW_DEVICE","authenticationLevel":"ONE_FACTOR","gcid":"bb2e64a9-1b39-4692-9c52-4845eb15c4f7","secretKnowledges":[{"questionId":11301},{"questionId":11302}],"secretKnowledgeActivated":true,"status":"ACTIVATED"}}

而不是我收到以下错误:

Action.c(23): Error -26377: No match found for the requested parameter "questionId". Either the specified boundaries were not found in the response or the matched text is longer than current max html parameter size of 8000 bytes. The total length of the response is 1506 bytes. You can use web_set_max_html_param_len to increase the max parameter size.    [MsgId: MERR-26377]Action.c(23): Notify: Saving Parameter "questionId = ".

我做错了什么?

1 个答案:

答案 0 :(得分:1)

不确定我是否理解你。如果您需要响应中所有 questionId 参数的值,请尝试以下操作:

web_reg_save_param("questionId", "LB={\"questionId\":", "RB=}", "Ord=All", LAST);

这将生成一系列参数 questionId_1 questionId_2 等。此外,参数数量将保存到 questionId_count 参数。但是如果您只需要第一次出现该参数,只需跳过 Ord = All 参数。

还有一个针对JSON响应的特殊提取API:web_reg_save_param_json。以下是您案例的一个示例:

web_reg_save_param_json("ParamName=questionId", "QueryString=$..questionId",
   "SelectAll=Yes", LAST);

此外,如果您需要基于RegEx的参数提取,可以尝试web_reg_save_param_regexp