【性能测试】:记一次性能测试脚本开发-缺少报文头

一,简单的web页面,通过录制 登录+ 新建计划 两个交易的请求

  · 很显然,开始提取登录后的token值,提示

No match found for the requested parameter "token". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes,

  所以在脚本前用 web_set_max_html_param_len("10240");拓展存储token字段的长度;

      · token值取出之后,发现脚本中只有一个地方使用到了:

web_add_cookie("token={token}; DOMAIN=mtsweb-test.eaf.evergrande.com");

  参数化之后,重跑脚本,发现提示:未登录。

二,然后就疑惑了,为啥还提示未登录呢,对比了下页面请求和脚本请求,发现

脚本中缺少报文头

所以,使用LR自带函数 web_add_auto_header("Authorization","{token}");补充完整

三,再次执行,新建计划成功。

原文地址:https://www.cnblogs.com/fy--/p/9083518.html