个人测试工作总结-性能测试

上一篇 / 下一篇  2020-12-16 11:11:58 / 个人分类:性能测试

loadrunner性能测试-接口测试脚本示例

TestCase(){                                                     //注释
    lr_save_string(lr_eval_string("{CanShuHua}"), "参数化");
    lr_output_message(lr_eval_string("{参数化}"));
    lr_convert_string_encoding("性能测试",NULL,LR_ENC_UTF8,"客户姓名");
    web_set_max_html_param_len("2048");
    web_reg_save_param("Response","LB={\"sys\"","RB=}}",LAST);
    web_add_header("biz_appKey","user1");
    web_add_header("biz_appSecret","123456");
    web_add_header("biz_apiId","DPopcumb");
    web_add_header("rpc_group","CS");
    web_add_header("rpc_version","1.0");
    web_add_header("EventCode","{biz_}{serviceSeqNum}");
    lr_start_transaction("事务开始");
    web_custom_request("web_custom_request",
  "URL=http://10.8.64.228:8090/gateway",
  "Method=POST",
  "Resource=0",
  "EncType=application/x-www-form-urlencoded;charset=utf-8",
  "RecContentType=application/json",
  "Referer=",
  "Body={\"input\":{\"custno\":\"{客户号}\","
  "\"custcn\":\"{客户姓名}\","
  "\"custlv\":\"04\","
  "\"chekrs\":\"02\","
  "\"certtp\":\"100\","
  "\"certno\":\"{身份证}\","
  "\"islgef\":\"1\","
  "\"stardt\":\"20170101\","
  "\"efctdt\":\"20270101\","
  "\"mobitl\":\"{teleno}\","
  "\"custst\":\"1\","
  "\"renatg\":\"1\"},"
  "\"sys\":{\"BizSrvId\":\"CustTran.CSC1P000101\"},"
  "\"comm_req\":{\"corpno\":null,\"cnfmsq\":null,\"rlacna\":null,\"ckdctp\":null,"
  "\"iscksl\":null,\"userid\":\"{柜员号}\",\"ckslsq\":null,\"csbxno\":null,\"brchno\":\"{机构号}\","
  "\"rcrdnm\":null,\"ckslac\":null,\"trantp\":null,\"lttscd\":\"opcumb\","
  "\"mdtrsq\":null,\"corrtg\":null,\"mutrcd\":null,\"ckdcno\":null,\"smalfr\":null,"
  "\"cityno\":null,\"ckbkus\":null,\"authsq\":null,\"mdtrtm\":null,\"prcscd\":\"CSC1P000101\","
  "\"sessid\":null,\"toacct\":null,\"mdtrdt\":null,\"ckacpw\":null,\"cksltp\":null,"
  "\"cgacpw\":null,\"acctno\":null,\"servtp\":\"9999\",\"winame\":null,\"begnno\":null,"
  "\"custno\":null,\"gsystdt\":null,\"cgtrtp\":null,\"tmnlip\":null,\"rlacct\":null,"
  "\"cktram\":null,\"cgacam\":null,\"cgacct\":null,\"manutg\":null,\"csystdt\":null}}",
  "TargetFrame=",
  LAST);
 lr_convert_string_encoding(lr_eval_string("{Response}"),"utf-8",NULL,"msg");
    if((strstr(lr_eval_string("{Response}"),"status\":\"S"))==NULL){   //errorCode\":\"
     lr_end_transaction("事务名称", LR_FAIL);
  lr_output_message("事务失败:%s", lr_eval_string("{msg}"));
 }else{
  lr_end_transaction("事务名称", LR_PASS);
  lr_output_message("事务成功:%s", lr_eval_string("{msg}"));
 }
}

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2021-02-26  
 123456
78910111213
14151617181920
21222324252627
28      

数据统计

  • 访问量: 3615
  • 日志数: 6
  • 建立时间: 2020-11-26
  • 更新时间: 2021-02-05

RSS订阅

Open Toolbar