LoadRunner---http请求中对中文参数的处理

Loadrunner 做保险承保业务测试

1. 保险正常业务流程:保费计算---》保存---》申请核保---》核保---》缴费(出保单)

问题一描述

保费计算接口中,需要把车牌号作为参数,车牌号中包含中文,parament list 中中文 用gb2312编码,直接传参会转为乱码

解决办法:

将参数先转换为utf-8,再作为请求参数

参考代码如下:

lr_convert_string_encoding(
lr_eval_string("{licenseNo}"),"gb2312","utf-8","str" ); strcpy(tmp, lr_eval_string("{str}")); lr_save_string(tmp,"licenseNo");

问题二描述:

脚本录制,参数化完成后,Replay时,申请核保无法生成待核保状态的单。所有单子都是暂存状态。

解决办法:

将申请核保系统返回结果,打印出来。

参考代码如下:

//参数化

//Correlation comment - Do not change!Original value='SUCESS' Name ='ResultType'
web_reg_save_param_ex(
"ParamName=ResultType",
"LB=RESULT_TYPE:\'",
"RB=\',CODE_TYPE:",
SEARCH_FILTERS,
"Scope=All",
"RequestUrl=*/actionservice.ai*",
LAST); web_reg_save_param_ex(
"ParamName=ResultMsg",
"LB=\"msg\":\"",
"RB=\",\"isBtnDisable\"",
SEARCH_FILTERS,
"Scope=All",
"RequestUrl=*/actionservice.ai*",
LAST); web_submit_data("actionservice.ai_59",
"Action=http://10.15.22.14:8005/nonvhl/policyAppBizAction_submitToUnderwriting/actionservice.ai",
"Method=POST",
"TargetFrame=",
"Referer=http://10.15.22.14:8005/nonvhl/policy/universal/ply_main.jsp?prodNo=0104 璐骇缁煎悎闄\xA9&scene=PLY_APP_NEW_SCENE&bsType=1&__param_data=1",
"Snapshot=t345.inf",
"Mode=HTML",
ITEMDATA,
"Name=SERVICE_TYPE", "Value=ACTION_SERVIC", ENDITEM,
"Name=CODE_TYPE", "Value=UTF-8", ENDITEM,
"Name=BEAN_HANDLE", "Value=baseAction", ENDITEM,
"Name=ACTION_HANDLE", "Value=perform", ENDITEM,
"Name=SERVICE_NAME", "Value=policyAppBizAction", ENDITEM,
"Name=SERVICE_MOTHOD", "Value=submitToUnderwriting", ENDITEM,
"Name=DW_DATA", "Value=%3Cdata%3E%3C%2Fdata%3E", ENDITEM,
"Name=HELPCONTROLMETHOD", "Value=common", ENDITEM,
"Name=SCENE", "Value=UNDEFINED", ENDITEM,
"Name=BIZ_SYNCH_LOCK", "Value=", ENDITEM,
"Name=BIZ_SYNCH_MODULE_CODE", "Value=", ENDITEM,
"Name=BIZ_SYNCH_NO", "Value=", ENDITEM,
"Name=BIZ_SYNCH_DESC", "Value=", ENDITEM,
"Name=BIZ_SYNCH_CONTINUE", "Value=false", ENDITEM,
"Name=CUST_DATA", "Value=appNo%3D{AppNo}%23%23%23taskId%3D0%23%23%23updTm%3D{BaseUpdTm}", ENDITEM,
LAST); lr_output_message("验证是否关联成功,打印ResultType: %s", lr_eval_string("{ResultType}")); //中文输出
lr_convert_string_encoding( lr_eval_string("{ResultMsg}"),
"utf-8",
"gb2312",
"str" ); if (atoi(lr_eval_string("{S_Count}")) != ){ //判断如果SUCESS字符串出现次数大于0 web_reg_find()可以计数 lr_output_message("申请核保成功!message :%s",lr_eval_string("{str}"));} else{ //如果出现次数小于等于 lr_error_message("申请核保失败!message :%s", lr_eval_string("{str}")); }//在日志中输出Log on failed
上一篇:仅当使用了列列表并且 IDENTITY_INSERT 为 ON 时,才能为表'xxxx'中的标识列指定显式值


下一篇:使用其他服务器引入JS文件