一、介绍
JMeter主要用于压力测试,使用Java编写,由Apache基金会管理
参考资料:
Aggregate监控器:
http://www.51testing.com/html/51/n-866351.html
二、启动Jmeter
下载Jmeter后解压包,定位到bin目录下,运行jmeter.bat,弹出运行主界面
运行Jmeter可能抛异常:
'findstr'不是内部或外部命令 解决方法
解决方法:
系统环境变量 Path 新增
%SystemRoot%\system32;%SystemRoot%;(最前面要用;分号隔开)
三、使用Jmeter测试asp.net webapi接口
1、新增线程组
![](https://i-blog.csdnimg.cn/blog_migrate/2cf36c9f23cdae528300a3b37471b85c.png)
设置线程组参数
![](https://i-blog.csdnimg.cn/blog_migrate/a7fd001684a2f8756c31ff7a4ad8604d.png)
2、新增HttpRequest:
在新增的线程组单击右键
![](https://i-blog.csdnimg.cn/blog_migrate/25c290737ec8fed031e92de1bd5af9b4.png)
3、设置Http请求Url、请求方法、请求参数等
![](https://i-blog.csdnimg.cn/blog_migrate/81d0b534e3ed8d7db5de82f13d519c6b.png)
4、设置Http请求头信息
![](https://i-blog.csdnimg.cn/blog_migrate/0b29b3dcfe26647a19914fe76b054fd4.png)
![](https://i-blog.csdnimg.cn/blog_migrate/b781646a00d2d2e50bc448b7659f29eb.png)
5、新增性能监听器,查看性能指标
a) Aggregate监控器:
http://www.51testing.com/html/51/n-866351.html
![](https://i-blog.csdnimg.cn/blog_migrate/5d696a1bcacc455ff96760ae95e88468.png)
监控结果
![](https://i-blog.csdnimg.cn/blog_migrate/17527a455516fd1ecb575b790c6adec9.png)
b) View Results Tree:记录每次请求信息,成功用绿色表示,失败用红色表示
![](https://i-blog.csdnimg.cn/blog_migrate/1f186580d4d3b02a6121f46cbe362958.png)
c) Graph Results:图形化监听器