jmeter负载测试测试
This Article will help the novice users to use JMeter for load testing their web application. Most web applications failures are because of performance issues, so it is a must that you have a performance requirement to your product. There are a lot of tools available in the industry for performance tuning / testing, but most of them are too costly to be implemented by smaller companies. Open source products like JMeter is one of the products, in which you can do some basic load testing of your product, but without the hefty price tag.
本文将帮助新手用户使用JMeter对其Web应用程序进行负载测试。 大多数Web应用程序故障都是由于性能问题引起的,因此必须对产品有性能要求。 业界有很多用于性能调整/测试的工具,但是其中大多数工具的成本太高,无法由较小的公司实施。 像JMeter这样的开源产品就是其中一种产品,您可以在其中对产品进行一些基本的负载测试,但价格却不高。
Hopefully this will help you get started on the basic flow of using JMeter once you have gone through the article in its entirety and exploring the tool for yourself.
希望这将帮助您在阅读完全文并亲自探索该工具后开始使用JMeter的基本流程。
Download JMeter from the link:
从链接下载JMeter:
http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi http://jakarta.apache.org/site/downloads/downloads_jmeter.cgiOnce downloaded, extract the zip file and go to the bin folder, where you will find the jmeter.exe file. Double-click on that file. In the JMeter window tree view you will find two items: workbench and test plan. Workbench is usually used to test and create components of your test. Test Plan is used to run the tests using the components created in the Workbench.
下载完成后,解压缩zip文件并转到bin文件夹,您将在其中找到jmeter.exe文件。 双击该文件。 在JMeter窗口树视图中,您将找到两个项目: 和 。 工作台通常用于测试和创建测试的组件。 测试计划用于使用在工作台中创建的组件运行测试。
Note: in order to run jmeter.exe, you need to 注意:为了运行jmeter.exe,您需要 have installed a Java Developer's Kit (JDK) and configured the JDK bin in your system's PATH environment variable. 安装 Java开发人员工具包(JDK)并在系统的PATH环境变量中配置JDK bin。Proxy Server
代理服务器
JMeter supports recording of the user action. This is done with the help of the proxy server of JMeter. To create the proxy server, right-click on the Workbench and go to "non test elements", then add a proxy server and provide the required port number (default 8080). Now go to your web browser and change your connection settings so that each HTTP request you make will be tunnelling through the JMeter proxy and gets recorded.
JMeter支持记录用户操作。 这是在JMeter的代理服务器的帮助下完成的。 要创建代理服务器,请右键单击工作台,然后转到“非测试元素”,然后添加代理服务器并提供所需的端口号(默认为8080)。 现在转到Web浏览器并更改连接设置,以便您发出的每个HTTP请求都将通过JMeter代理进行隧道传输并得到记录。
Settings can be done as below.Internet Explorer
IE浏览器
Tools->Internet Options->Connections->Prox
工具-> Internet选项->连接->代理 y设置
here put localhost as host and port that you have given in JMeter proxy (default 8080)
这里将本地主机作为您在JMeter代理中提供的主机和端口(默认为8080)
FireFox
火狐
Tools->Advanced->Network->
工具->高级->网络-> 连接 ->代理设置
here put localhost as host and port that you have given in JMeter proxy (default 8080)
这里将本地主机作为您在JMeter代理中提供的主机和端口(默认为8080)
Recording a user action
记录用户动作
Once the settings are done, you have to start the JMeter proxy server, go to the browser in which you have made the proxy settings and access your web site on which you have to run the test, doing the necessary action(s) which you consider "business critical" or in which your are expecting some system failure. These action(s) will be recorded in the workbench.
设置完成后,您必须启动JMeter代理服务器,转到已在其中进行代理设置的浏览器,然后访问必须运行测试的网站,并执行必要的操作。考虑“关键业务”或您期望系统出现故障的情况。 这些操作将记录在工作台中。
Playback settings
播放设定
Now go to Test Plan in the tree view window and right-click then create a new ThreadGroup. Cut all the components from workbench and paste it to this new ThreadGroup. In the ThreadGroup, you can mention the number of times the use case needs to be executed in "Loop Count", the number of parallel users in "Number of Threads" and the time gap between which users are introduced to system in "Rampup" setting.
现在,在树视图窗口中转到“测试计划”,右键单击,然后创建一个新的ThreadGroup。 从工作台上剪切所有组件并将其粘贴到此新的ThreadGroup中。 在ThreadGroup中,您可以在“循环计数”中提及需要执行用例的次数,在“线程数”中提及并行用户的数目,在“ Rampup”中提及引入用户之间的时间间隔设置。
Results Aggregation
结果汇总
once these settings are done you need to add a aggregate graph to view the results (number of hits and misses) by right-clicking on the ThreadGroup and selecting add->listener->aggregate graph.
完成这些设置后,您需要通过右键单击ThreadGroup并选择add-> listener-> aggregate graph,添加一个聚合图以查看结果(命中和未命中的数目)。
Playback
回放
To start the test go to run menu and select start.
要开始测试,请转到运行菜单,然后选择开始。
This ends the basic flow of using JMeter. Along with this, you can use some profiler tools to profile your product if you find some issues while doing the load test. Please continue to explore for yourself, as there is more to this tool than covered in this basic usage guide. You will find JMeter supports most of the features that other licensed load testing products support apart from that it is not UI rich.
这样就结束了使用JMeter的基本流程。 与此同时,如果在进行负载测试时发现一些问题,则可以使用一些探查器工具来探查产品。 请继续自己探索,因为此工具的功能超出了本基本使用指南的范围。 您会发现JMeter支持其他许可的负载测试产品支持的大多数功能,但它不具有丰富的UI。
翻译自: https://www.experts-exchange.com/articles/1947/Using-jmeter-for-web-loadtesting.html
jmeter负载测试测试