Jmeter simple stress test!

Today we use Apache Jmeter (an interface testing tool) to conduct stress testing learning. The main purpose of stress testing is to test the implementation effect of load balancing.

The installation of Jmeter will not be explained here. Just go online and download the latest version. Because Jmeter is developed by JAVA language, you must configure the Java environment before installation.

After installation, there is a Jmeter.bat file in the bin directory of Jmeter, which can be run by double-clicking it.

picture

After running the software, we right-click "Test Plan" - "Add" - "Threads (Users) - Thread Group", thus creating a thread group, which is of course used to run threads.

After we have the thread group, we right-click the thread group, "Add" - "Configuration Component" - "http request default value", where you can set some commonly used default settings. Here I enter our test server IP or domain name, here I enter "127.0.0.1", and the port number is "8000", (because the address I want to test is: 127.0.0.1:8000) the protocol is "http", if the URL to be tested is https Fill in "https" at the beginning, and leave the rest as default. At this time, click Save in the upper left corner and a save box will pop up. This allows you to save the test configuration you have made now. If you need to test again in the future, just open the saved jmx file directly. .

picture

After saving, we right-click "Thread Group" - "Add" - "Sampler" - "http request". Isn't this the same as the "http request default value" just now? The one just now is just the default value, just used to set some default configurations. What actually initiates the request is the "http request".

现在我也找了很多测试的朋友,做了一个分享技术的交流群,共享了很多我们收集的技术文档和视频教程。
如果你不想再体验自学时找不到资源,没人解答问题,坚持几天便放弃的感受
可以加入我们一起交流。而且还有很多在自动化,性能,安全,测试开发等等方面有一定建树的技术大牛
分享他们的经验,还会分享很多直播讲座和技术沙龙
可以免费学习!划重点!开源的!!!
qq群号:691998057【暗号:csdn999】

Then, we right-click "Thread Group" - "Add" - "Listener" - "View Number of Results", where you can view http requests and results. Every time you create a new component and modify the configuration information, click Save. The page configuration diagram is as follows: In the http request, we enter an interface of the local machine in the "Path", which means the default path, and the IP column is not used. Entered. This is because the IP address has been entered in the http request default value. You can create multiple http requests in the future, just modify the path, so that you can access different pages of the same website. This is the meaning of "http request default value" So, just write down some common settings.

picture

View the results of the result tree

Our new "http request" returns a result of 200, indicating that the request is successful. It can also be seen from the green check mark. The drop-down list box in the above picture can select the display format. We select json and switch to "Response Data" to see the return. page.

Set the number of thread concurrency

Next, click "Thread Group" to see the thread group settings page. The default setting is 1 thread, start in 1 second, and cycle once. The number of threads indicates how many threads are started, the Ramp-Up Period indicates how long it takes to start all threads, and the number of cycles indicates the number of executions of each thread. For example, I set the number of threads to 4, the Ramp-Up Period to 3, and the number of loops to 2, which means that the software will start 4 threads in 3 seconds, that is, 1 thread will be started in 3/4 seconds, and each thread will execute 2 requests. .

Take a look at the form result tree

picture

Thread concurrency settings

In addition, you can also check "Scheduler". For example, I fill in the duration of 20, the start delay of 0, and check the number of loops in "Forever", which means that the thread starts immediately and stops after 20 seconds. It should be noted that if the duration and start delay are set, the following start time and end time will not work, so don't worry about it, just click run.

Previously, I only set up the "View Result Tree" listener. Now I can right-click "Thread Group" - "Add" - "Listener". There are many listeners to choose from, such as graphical results, which can be viewed in a table. Results, aggregate reports, etc., these are indicator data that reflect the testing process. The graphical results display throughput, offset, average and other information in the form of graphics. The tabular results display the time of each request, return, number of bytes sent, connection time, etc. The aggregate report displays the overall request throughput and errors. rate and so on. The figure below shows the format of the table results.

picture

Finally, I would like to thank everyone who read my article carefully. Looking at the increase in fans and attention, there is always some courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly!

Software Testing Interview Document

We must study to find a high-paying job. The following interview questions are from the latest interview materials from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and some Byte bosses have given authoritative answers. After finishing this set I believe everyone can find a satisfactory job based on the interview information.
 

Insert image description here

 

Guess you like

Origin blog.csdn.net/IT_LanTian/article/details/135019323