程序员潇然 发表于 2022-6-16 11:48:54

[Jmeter]windows 安装Jmeter进行Tcp测试查看结果 中文乱码问题解决

### 网址


`https://jmeter.apache.org/`

### 下载

!(data/attachment/forum/202206/16/114652hz33l78pponoo7t9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")
!(data/attachment/forum/202206/16/114709o9ifl6i7fzl9csal.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

#### 自行检查环境变量 path是否配置,Jmeter运行依赖

步骤略

### 运行

!(data/attachment/forum/202206/16/114724nlg0uyv0l8kquz12.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

成功运行会启动JMeter GUI工具

### 设置语言(可选)

选择Options --> Choose Language --> Chinese(Simplified),设置语言为中文简体

### 基本使用

1.选择TestPlan,右键-->添加-->线程-->线程组
!(data/attachment/forum/202206/16/114734cnzhbnrzu60c2n29.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

2.线程组内容如下,无特殊需求,直接默认即可
!(data/attachment/forum/202206/16/114742q77wbvvn5vrisp7e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

3.请求添加, 选择线程组,右键-->添加-->取样器
!(data/attachment/forum/202206/16/114750r36b3pza6jvq3waq.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

不仅支持http 还支持tcp,此时我选择了tcp

4.选择线程组,右键-->添加-->监听器-->查看结果树
!(data/attachment/forum/202206/16/114757ta7pohharggaybpb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

5.执行测试
!(data/attachment/forum/202206/16/114809jn7bo0ly7j7ussy2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

6.查看结果
!(data/attachment/forum/202206/16/114819htgq0pi04313047g.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")
!(data/attachment/forum/202206/16/114827srt1rjg4ieuroz3e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

通过jmeter和服务端可以看到 数据成功传输。
`作者:程序员潇然 疯狂的字节X https://crazybytex.com/`

### 问题

上图可以看到中文乱码了,项目中的设置是没有问题的,那就只能是Jmeter的设置有问题了

看下配置文件

jmeter.properties

可以找到,default to Platform defaults charset as returned by Charset.defaultCharset().name()如果不设置按照平台默认的
!(data/attachment/forum/202206/16/114841e23u3cw23885dc5w.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

所以指定一下

```tcp.charset=UTF-8```

重启Jmeter,然后重试查看结果:
!(data/attachment/forum/202206/16/114847eb5qcbbbhpq5qqqj.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

```转载务必注明出处:程序员潇然,疯狂的字节X,https://www.crazybytex.com/thread-13-1-1.html

```

!(data/attachment/forum/202206/16/141330jha7st9soow8772i.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "common_log.png")
`转载务必注明出处:程序员潇然,疯狂的字节X,https://www.crazybytex.com/thread-13-1-1.html `

页: [1]
查看完整版本: [Jmeter]windows 安装Jmeter进行Tcp测试查看结果 中文乱码问题解决