【原】LoadRunner笔记

LR手动编辑脚本尝试:
参考:https://www.cnblogs.com/guanfuchang/p/6203994.html

    // 事务开始:设置事务名称
    lr_start_transaction("事务名称");

    // 设置(注册)文件检查
    web_reg_find("TEXT=\"auto\":\"E\"",  "Search=Body", LAST);

    // 匹配响应消息体(完整,包括消息头)
    web_reg_save_param("myresponse", "LB=", "RB=", LAST);

    // 发起请求
    web_custom_request("Test",
                       "URL=http://xxx.xxx.xxx",
                       "Method=POST",
                       "Resource=0",
                       "RecContentType=application/json",
                       "Referer=",
                       "Mode=HTML",
                       "EncType=application/json;charset=UTF-8",
                       "Body={}",   
                       LAST);

    // 打印一下接口请求的响应结果,使用函数lr_eval_string
    lr_log_message("response:%s", lr_eval_string("{myresponse}"));

    // 事务结束:根据事务名称,可以在这里灵活设置事务执行的结果
    lr_end_transaction("事务名称",LR_AUTO);

LR对于https的协议,如果编写或录制之后,回放失败,可以脚本前面加上一行:

web_set_sockets_option("SSL_VERSION", "TLS1.1");

猜你喜欢

转载自blog.csdn.net/Csunshine211/article/details/81946338