Jmeter graphic installation and getting started tutorial

A, JMeter Introduction

  Apache JMeter is an organizational development of Java-based stress test tools. For software to do the stress test, which was originally designed for testing Web applications, but later extended to other test areas. It can be used to test static and dynamic resources, such as static files, Java servlets, CGI scripts, Java objects, databases, FTP servers, and so on. JMeter can be used to great load to a server, or network objects in the simulation, testing and analysis of their strength from the overall performance under different load types. In addition, JMeter can do functional / application regression testing , through the creation of scripts with assertions to verify your program returns the results you expect. For maximum flexibility, JMeter allows the use of regular expressions to create assertion.

  In simple terms, JMeter is the main tool used to perform load testing, performance testing and stress testing. Load testing, performance testing and stress testing concept:

   Load Test: Test such that the system or application design in advance the test run good extreme scenario. Such testing procedures used to evaluate the behavior of the system or under extreme conditions.

  Performance Test: This test is used to detect the performance of the system, including the particular case, responsiveness and stability of the system.

  Stress Test: This test by loading more external resources, and system components beyond the capabilities of their set, trying to make the system hang.

 

Second, download and install configuration

 

  1. Download: http://jmeter.apache.org/download_jmeter.cgi   ( before you download and install JMeter, first configure the java environment in order to use JMeter oh ).

 

  

 

 

  2. After the download is complete, unzip to where you want to unpack the

 

  3. Set Environment Variables

    ①在用户变量量中新建用户名“JMETER_HOME”,变量值为“D:\apache-jmeter-5.1.1\apache-jmeter-5.1.1” (这里是你自己的解压后的文件夹的地址)。

      

 

    ②在系统变量中的"CLASSPATH"追加“;%JMETER_HOME%\lib\ext \ApacheJMeter_core.jar;%JMETER_HOME%\lib\jorphan.jar;%JMETER_HOME%\lib \logkit-1.2.jar;”。

 

      

 

 

      在这里有一点需要注意,在我的安装目录中并没有找到lib\logkit-1.2.jar这个jar包,所以,在这里需要自行下载一个jar包到lib目录下。下载地址:http://www.java2s.com/Code/Jar/l/logkit.htm

 

 (别忘了解压到JMeter的lib目录下哦)

 

    4.打开JMeter

    打开bin目录下的JMeter的bat文件,即可运行打开JMeter。

 

    

   

   

 

三、JMeter入门压测实例

 

  1.新建一个线程组。JMeter是java实现的,并且使用一个java线程来模拟一个用户,因此线程组就是一组虚拟用户的意思。这些虚拟用户是用来模拟访问被测系统。

 

  

 

  2.设置线程参数。

    ①线程数(用户):想要模拟的虚拟用户的数量。

    ②Ramp-Up Period (in seconds)(虚拟用户增长时长):设置的虚拟用户访问url的时长,是在一个时间同时访问,还是在一段时间持续访问。

     这里引用一个前辈举的例子:

  比如你测试的是一个考勤系统,那么实际用户登录使用考勤系统的时候并不是大家喊1、2、3 - 走起,然后一起登录。实际使用场景可能是9点钟上班,那么从8:30开始,考勤系统会陆陆续续有人开始登录,直到9:10左右,那么如果完全按照用户的使用场景,设计该测试的时候此处应输入40(分钟)* 60(秒)= 2400。但是实际测试一般不会设置如此长的Ramp-Up时间,原因嘛,难道你做一次测试要先等上40分钟做登录操作?一般情况下,可以估计出登录频率最高的时间长度,比如此处可能从8:55到9:00登录的人最多,那这里设置成300秒,如果“线程数”输入为100,则意味着在5分钟内100用户登录完毕。 

 ③循环次数:设置一个虚拟用户循环做多少次测试,默认为1,做完一遍就结束。选中“永远”运行起来永远不会停止,一直循环,只能手动停止了。

 

   

 

 

  3.添加被测的页面url或接口

 

  

 

 

 4.点击运行,开始压测

 

 

 

5.查看运行日志

 

 

 

 

 6.新增监听器,用于查看压测结果。这里添加3种:聚会报告、图形报告、用表格查看结果,区别在于结果展现形式的不同。

 

 

 

 

 

 再次运行,进行压测,监听结果如下:

 

 

 

其他关于JMeter庞大的功能,待我后续挖掘~

Guess you like

Origin www.cnblogs.com/l199616j/p/11550810.html