【问题标题】:unable to get the correlation details in vugen scripting无法在 vugen 脚本中获取相关详细信息
【发布时间】:2018-04-17 13:27:24
【问题描述】:

下面是我的html代码

<tr role="row" class="even">
    <td class="sorting_1">AMT New Test Class</td>
    <td>FY19 - W14
        <br>Apr-30-2018</td>
    <td>FY19 - W14
        <br>May-1-2018</td>
    <td><span data-toggle="tooltip" data-original-title="Calendar"><a href="#" onclick="openCalenderModal(event,393517)" class="calenderPop"><i class="fa fa-calendar m-r-10" aria-hidden="true"></i></a></span><span data-toggle="tooltip" data-original-title="Copy"><a href="copySchedule?scheduleClassMainKey=393517&amp;type=copySchedule"><i class="fa  fa-clone m-r-10" aria-hidden="true"></i></a></span><span data-toggle="tooltip" style="cursor:pointer" data-original-title="Training Geography not available" onclick="doNothing(event)"><i class="fa fa-globe m-r-10" aria-hidden="true"></i></span><span data-toggle="tooltip" style="cursor:pointer" data-original-title="Comments: " onclick="doNothing(event)"><i class="fa fa-commenting  m-r-10" aria-hidden="true"></i></span></td>
</tr>

<tr role="row" class="odd">
   <td class="sorting_1">AMT New Test Class</td>
   <td>FY19 - W14<br>Apr-30-2018</td>
   <td>FY19 - W14<br>May-1-2018</td>
   <td><span data-toggle="tooltip" data-original-title="Calendar"><a href="#" onclick="openCalenderModal(event,393528)" class="calenderPop"><i class="fa fa-calendar m-r-10" aria-hidden="true"></i></a></span><span data-toggle="tooltip" data-original-title="Copy"><a href="copySchedule?scheduleClassMainKey=393528&amp;type=copySchedule"><i class="fa  fa-clone m-r-10" aria-hidden="true"></i></a></span><span data-toggle="tooltip" style="cursor:pointer" data-original-title="Training Geography not available" onclick="doNothing(event)"><i class="fa fa-globe m-r-10" aria-hidden="true"></i></span><span data-toggle="tooltip" style="cursor:pointer" data-original-title="Comments: " onclick="doNothing(event)"><i class="fa fa-commenting  m-r-10" aria-hidden="true"></i></span></td>
</tr>

我的vugen 脚本看起来像

web_submit_data("getClassDetails_2", 
        "Action= websiteURL /getClassDetails", 
        "Method=POST", 
        "RecContentType=application/json", 
        "Referer= websiteURL /manage_schedules", 
        "Snapshot=t320.inf", 
        "Mode=HTTP", 
        ITEMDATA, 
        "Name=draw", "Value=1", ENDITEM, 
        "Name=columns", "Value=classSubtypeMaster.classSubtypeName,classSubtypeMaster.classSubtypeKey,divRegJson,finalWeekMapJson,finalWeekMapJson,createdOnDate,createdByUserId,scheduleClassMainKey,scheduleStartId.clndrDate,scheduleEndId.clndrDate,occrStartFiscalWeek,occrEndFiscalWeek,comments", ENDITEM, 
        "Name=order[0][column]", "Value=0", ENDITEM, 
        "Name=order[0][dir]", "Value=asc", ENDITEM, 
        "Name=start", "Value=0", ENDITEM, 
        "Name=length", "Value=10", ENDITEM, 
        "Name=search[value]", "Value=", ENDITEM, 
        "Name=search[regex]", "Value=false", ENDITEM, 
        "Name=nodeList", "Value=18", ENDITEM, 
        "Name=nodeIdList", "Value=3", ENDITEM, 
        "Name=searchColumns",         "Value=classSubtypeMaster.classSubtypeKey,divRegJson,finalWeekMapJson", ENDITEM, 
        LAST);

在这一步之前,我将这些放在web_reg_save_param_ex 函数下面

我尝试使用以下web_reg_save_param_ex

第一次尝试

web_reg_save_param_ex(
        "ParamName=scheduleClassMainKey",
        "LB=onclick=\"openCalenderModal(event,",
        "RB=)\" class=\"calenderPop\">",
        "NotFound=error",
        "Ordinal=all",
        SEARCH_FILTERS,
        "Scope=BODY",
        "IgnoreRedirections=Yes",
        LAST);

第二次尝试

web_reg_save_param_ex(
        "ParamName=scheduleClassMainKey",
        "LB/RE=<a href=\"copySchedule?scheduleClassMainKey=",
        "RB=&amp;type=copySchedule\"><i ",
        "NotFound=warning",
        "Ordinal=all",
        SEARCH_FILTERS,
        "Scope=ALL",
        "IgnoreRedirections=Yes",
        LAST);

但输出错误

第一次尝试输出

Action.c(213): web_reg_save_param_ex started                [MsgId: MMSG-26355]
Action.c(213): Registering web_reg_save_param_ex was successful          [MsgId: MMSG-26390]
Action.c(224): web_submit_data("getClassDetails") started          [MsgId: MMSG-26355]
Action.c(224): Error -26377: No match found for the requested parameter "scheduleClassMainKey". 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(224): Notify: Saving Parameter "scheduleClassMainKey_count = 0"

将参数保存为lr_output_message("PC:%d",atoi(lr_eval_string("{scheduleClassMainKey_count}")));

第二次尝试

Action.c(245): Notify: Parameter Substitution: parameter "scheduleClassMainKey_count" =  "0"
Action.c(245): 0
Action.c(246): Warning:

基于尝试的 cmets,但在输出窗格中仍然出现以下错误:

Action.c(203): web_submit_data("getClassDetails_2") started [MsgId: MMSG-26355] Action.c(203): Error -26377: No match found for the requested parameter "scheduleClassMainKey". 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(203): Error -26377: No match found for the requested parameter "_scheduleClassMainKey". 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(203): web_submit_data("getClassDetails_2") highest severity level was "ERROR", 177 body bytes, 510 header bytes, 11 chunking overhead bytes [MsgId: MMSG-26387] Ending action Action.

谁能告诉我我哪里做错了。

【问题讨论】:

    标签: performance-testing load-testing loadrunner vugen


    【解决方案1】:

    web_reg_save_param_ex 的两个简化版本都成功地从提供的响应片段中提取值。

    web_reg_save_param_ex(
        "ParamName=scheduleClassMainKey",
        "LB=onclick=\"openCalenderModal(event,",        
        "RB=)\" class=\"calenderPop\">",
        "Ordinal=all",
        SEARCH_FILTERS,
        "Scope=Body",
        LAST);
    
    web_reg_save_param_ex(
        "ParamName=_scheduleClassMainKey",
        "LB=<a href=\"copySchedule?scheduleClassMainKey=",
        "RB=&amp;type=copySchedule\"><i ",
        "Ordinal=all",
        SEARCH_FILTERS,
        "Scope=Body",
        LAST);      
    

    输出:

    Notify: Saving Parameter "scheduleClassMainKey_1 = 393517".
    Notify: Saving Parameter "_scheduleClassMainKey_1 = 393517".
    Notify: Saving Parameter "scheduleClassMainKey_2 = 393528".
    Notify: Saving Parameter "_scheduleClassMainKey_2 = 393528".
    ...
    Notify: Saving Parameter "scheduleClassMainKey_count = 2".
    Notify: Saving Parameter "_scheduleClassMainKey_count = 2".
    

    请确认您在重播日志中没有其他错误/警告,并且实际的服务器响应包含预期的 html 代码。

    在您上次更新之后。重播日志中的这段引述表明,与提供的响应片段相比,响应正文的大小要小得多(177 字节)。

    Action.c(203):web_submit_data("getClassDetails_2") 最高严重级别为“ERROR”,177 个正文字节,510 个标头字节,11 个分块开销字节

    请在包含“高级跟踪”和“服务器返回的数据”的运行时设置中启用扩展日志,然后再次运行脚本以查看实际的服务器响应是否包含预期的数据。

    【讨论】:

    • 我已经添加了我的 vugen 脚本功能。但是在输出控制台中仍然出现错误(添加问题本身)
    【解决方案2】:

    您是否将这两个参数保存为同名“scheduleClassMainKey”?

    另外, 根据文档:

    The web_reg_save_param_ex function also supports array type parameters. When 
    you specify Ordinal=All, all the occurrences of the match are saved in an 
    array. Each element of the array is represented by the ParamName_index. See 
    Example of Parameter Arrays.
    In the following example, the parameter name is A:
    
    web_reg_save_param_ex("ParamName=A", "LB/ic=<a href=", "RB=\'>", 
    "Ordinal=All", LAST );
    
    The first match is saved as A_1, the second match is saved as A_2, and so 
    forth. You can retrieve the total number of matches by using the following 
    term: ParamName_count. For example, to retrieve the total number of matches 
    saved to the parameter array, use:
    
    TotalNumberOfMatches=atoi(lr_eval_string("{A_count}"));
    

    因此你需要使用的参数是 scheduleClassMainKey_1

    【讨论】:

    • 是的。忘记加行lr_output_message("PC:%d",atoi(lr_eval_string("{scheduleClassMainKey_count}")));
    • 然后将输出返回为 0
    • 对此有任何帮助
    • 抱歉延迟回复(我们度过了一个漫长的周末)。我问了我们的顶级专家 Leonid 来回答。查看其他答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-11
    • 1970-01-01
    • 1970-01-01
    • 2020-06-18
    • 1970-01-01
    相关资源
    最近更新 更多