z

zhaoyijun的个人空间

记录工作生活

  • 首页
  • 工作随笔
  • 日常
Home jmeter使用日志
文章

jmeter使用日志

Posted 2024-02-5 Updated 2024-03- 10
By zhaoyijun
8~10 min read

1、jtl文件生成html报告错误

XXX  does not contain the field names header, ensure the jmeter.save.saveservice.* properties are the same as when the CSV file was created or the file may be read incorrectly when generating report

An error occurred: Could not read sample

聚合报告-configure处做如下修改后可修复:

2、jtl文件生成html文件命令

一、如果没有.jtl文件,运行如下命令:

jmeter -n -t C:\测试计划.jmx -l result.jtl -e -o D:\apache-jmeter-5.1.1\result

参数:

-n :以非GUI形式运行Jmeter

-t :C:\测试计划.jmx 脚本路径

-l :result.jtl 运行结果保存路径(.jtl),此文件必须不存在

-e :在脚本运行结束后生成html报告

-o :D:\apache-jmeter-5.1.1\result 用于存放html报告的目录 

二、如果已经存在结果文件(.jtl),可运行如下命令生成报告

jmeter -g result.jtl -o /tmp/ResultReport

参数:

-g : result.jtl 已经存在的.jtl文件的路径。

-o :用于存放html报告的目录

https://zhuanlan.zhihu.com/p/93607268

3、导出用户名,线程编号,用户token至csv文件beanshell脚本

FileWriter fstream = new FileWriter("D:/jmeter脚本/学测/token22—18.csv",true);
BufferedWriter out = new BufferedWriter(fstream);
 
//out.write(ctx.getThreadNum());
out.write("${username}");
out.write(",");//换列
out.write("${__threadNum}");
out.write(",");
out.write("${authtoken}");
out.write(System.getProperty("line.separator"));//换行
 
out.close();
fstream.close();

4、登录密码md5加密beanshell脚本

import org.apache.commons.codec.digest.DigestUtils; //导入MD5加密需要用到的jar
String str =vars.get("pwd"); //密码变量名为pwd
String sign = DigestUtils.md5Hex(str);  //对str字符串进行MD5加密
System.out.print(sign);
vars.put("md5_pwd",sign);//把加密后的字符串转化成大写,并保存到变量md5_pwd中

5、线程无法全部结束

jmeter.bat文件的set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m,把-Xmx1g -XX:MaxMetaspaceSize=256m设置大一点,但是一般不超过机器内存一半。

6、正则提取接口全部响应内容

token :^(.*)$

工作随笔
jmeter
License:  CC BY 4.0
Share

Further Reading

Mar 10, 2024

安卓adb抓包

1、adb连接手机报10061 1) 将安卓设备usb连接到电脑 2)设备链接到wifi 3)Ping设备ip,检查是否可通信 4)在cmd依次输入以下命令: adb usb adb kill-server adb tcpip 5555 adb connect youip:5555 2

Mar 10, 2024

iphone使用tidevice自动化步骤

1、iphone安装WebDriverAgent 安装WebDriverAgent.ipa,保持WebDriverAgent打开状态; 2、windows端安装tidevice pip install tidevice tidevice常用命令: 查看第三方应用包名: tidevice applis

Feb 5, 2024

jmeter使用日志

1、jtl文件生成html报告错误 XXX does not contain the field names header, ensure the jmeter.save.saveservice.* properties are the same as when the CSV file was c

OLDER

大喜的日常

NEWER

iphone使用tidevice自动化步骤

Recently Updated

  • 安卓adb抓包
  • iphone使用tidevice自动化步骤
  • jmeter使用日志
  • 大喜的日常

Trending Tags

airtest jmeter

Contents

©2025 zhaoyijun的个人空间. Some rights reserved.

Using the Halo theme Chirpy