性能测试基础-开门篇3(LR常用函数介绍)

LR常用的函数,协议不一样函数会不一样,这里简单的介绍下HTTP\WEBSERVICE\SOCKET协议常用函数:

HTTP:

web_set_max_html_param_len("1024");//设置1行数据最大长度,经常会使用到

web_reg_save_param("SupplierId", "LB=SupplierId>", "RB=</b:SupplierId", "SEARCH=BODY", LAST);//关联函数

web_reg_find("Text/IC=code\":\"000000", "SaveCount=abc_count", "LAST"); //检查点

atoi(lr_eval_string("{abc_count}")//字符串转整型

web_add_header("user-agent","android"); //增加报文头信息

web_add_cookie("","domain=")//增加COOKIE

find_cnt = lr_xml_find("XML={response}", //XML返回报文查找节点内容
            "FastQuery=/Envelope/Body/sayHelloResponse/return",
            "Value=Hello world!",
            LAST);

SOCKET:

 lrs_create_socket("socket0", "TCP", "RemoteHost=127.0.0.1:22222",  LrsLastArg);

strcpy(cLine,lr_eval_string("<shuju>" ));

 lrs_get_last_received_buffer_size("socket0");

  lrs_send("socket0","buf0", LrsLastArg);
    lrs_receive("socket0","buf1",LrsLastArg);
posted @ 2016-10-26 18:04  stone_xiao  阅读(452)  评论(0编辑  收藏  举报