51Testing软件测试论坛

标题: 快来大神LoadRunner测试接口出现400和26377和26374报错 [打印本页]

作者: 308529002    时间: 2017-9-30 19:38
标题: 快来大神LoadRunner测试接口出现400和26377和26374报错
求大神指教,我该怎么修改,被卡2天了,好烦
场景:
1. 接口地址:http://abcdefg   (接口地址,不是URL网址)
2.Http-Method:POST
3. 输入参数说明:lineId
4.请求头参数:Accept-APIVersion:1.0          tokenId:(默认空,用户每次登陆后服务器返回)
userId: 18518771990    platformType: android
platformVersion:4.4     callTime:  564897946131
mobileBrand: xiaomi    mobileStandard: WCDMA
appVersionNo:1.0        sign:  f35b94f51d263eef08201bc4d8affd5c(MD5加密后)
我用LoadRunner写了2个脚本都报错:
脚本1:
lr_rendezvous("查询集合点");
lr_start_transaction("查询");
  web_add_header("Content-Type","application/json;charset=utf-8");
// web_reg_find("Text=message",
// LAST);
web_custom_request("app-querypath",
         "URL=http://abcdefg",
                            "Method=post",                  
       "TargetFrame=",
       "Resource=0",
       "Referer=",
                            "EncType=application/json;charset=UTF-8",
               
     //  "Body={\"Accept-APIVersion\":1.0,\"appVersionNo\":1.0,"
     //  "\"callTime\":564897946131,\"lineId\":1,\"mobileBrand\":xiaomi,"
     //  "\"mobileStandard\":WCDMA,\"platformType\":android,\"platformVersion\":4.4,"
     //  "\"sign\":f35b94f51d263eef08201bc4d8affd5c,\"tokenId\":,\"userId\":18518771990}",
                    
     "Body=&Accept-APIVersion=1.0&appVersionNo=1.0&callTime=564897946131&lineId=1"
  "&mobileBrand=xiaomi&mobileStandard=WCDMA&platformType=android&platformVersion=4.4"
  "&sign=f35b94f51d263eef08201bc4d8affd5c&tokenId=&userId=11111111111",
        LAST);
lr_end_transaction("查询",LR_AUTO);
报错: Action.c(12): Continuing after Error -26631: HTTP Status-Code=400 (Bad Request) for "http://abcdefg"   [MsgId: MERR-26631]
脚本2:
web_set_max_html_param_len("20000");
web_reg_save_param("result",
        "LB/IC=code",
        "RB/IC=serviceTime",
      "Search=body",
        LAST);
lr_rendezvous("APP列车位置查询");
lr_start_transaction("列车位置查询");
  
//检查点: oK
//  web_reg_find("Text=OK",
// LAST);
//发送请求
  web_submit_data("FollowersGetByName",
   "Action=http://abcdefg",
   "Method=POST",
   "Mode=HTML",
   ITEMDATA,

   "Name=APIVersion","Value=1.0",ENDITEM,
   "Name=appVersionNo","Value=1.0",ENDITEM,
   "Name=callTime","Value=564897946131",ENDITEM,
       "Name=lineId","Value=1",ENDITEM,
       "Name=mobileBrand","Value=xiaomi",ENDITEM,
       "Name=mobileStandard","Value=WCDMA",ENDITEM,
       "Name=platformType","Value=android",ENDITEM,
       "Name=platformVersion","Value=4.4",ENDITEM,
       "Name=sign","Value=f35b94f51d263eef08201bc4d8affd5c",ENDITEM,
       "Name=tokenId","Value=",ENDITEM,
       "Name=userId","Value=111111111111",ENDITEM,
                 LAST);
lr_end_transaction("列车位置查询",LR_AUTO);

//很多时候返回值有中文,需要转码,转码后的值存在了msg中
  lr_convert_string_encoding(lr_eval_string("{result}"),"utf-8",NULL,"msg");        
//打印返回值
lr_output_message("转换编码后msg----%s",lr_eval_string("{msg}"));
报错: Action.c(23): Continuing after Error -26377: No match found for the requested parameter "result". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 20000 bytes, use web_set_max_html_param_len to increase the parameter size   [MsgId: MERR-26377]
Action.c(23): Continuing after Error -26374: The above "not found" error(s) may be explained by header and body byte counts being 115 and 0, respectively.   [MsgId: MERR-26374]



作者: 308529002    时间: 2017-9-30 19:45
服务器正确的返回结果: {"code":0,"message":"OK","returnData":[],"totalDataCount":0,"serviceTime":1506787665773}
作者: yangxiaohu    时间: 2018-3-20 17:55
接口地址不对




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2