Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to do stress Test with Jmeter

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Jmeter is a performance testing tool, similar to loadrunner, it has more functions, our common function is to use jmeter to simulate multi-browsers to do stress testing on the website.

For our general website, we need to log in before entering the business function, and then we can access the business function. The following is how to use the jmeter login system to do stress testing on the main business.

1. Run jmeter

two。 Two nodes of the test plan and workbench will appear in the left tree.

3. Select the test plan and right-click-"add -" threads (users) thread group

The thread group can set how many threads to do the stress test concurrently.

In the "number of cycles" setting, do not select forever, set the number of cycles to 1.

4. Now let's show you how to set up a login http request, select a thread group, right-click-- add-- "sampler--" http request.

The http request mimics browser access.

In the "server name or ip" setting 127.0.0.1, port number setting: 8080, "method" setting post, path setting website login address, such as "/ exam/operatorAction".

You need to pass in the user and password for login. Add a parameter to the send parameters with request list. Parameter values are set according to the web application. Such as login_user=0001;login_password=1;actFlag=login

5. After a successful login, the site will generally jump to the main page. You can make a judgment in jmap to determine whether to log in and enter the main page as expected (this step may not be set). Select "http request" in 4, right-click-- "add--" assertion-- response assertion. "Apply to" set Main smaple only; "response field to test"set" url sample ";" pattern matching rule setting "includes", "pattern to test" increases the main page to which the page jumps to, such as "studentMain.jsp"

6. After logging in to a general website, session is generated in tomcat, and then there is no need to log in again to visit other pages, as long as the browser supports cookie. Similarly in jmap, if you want to continue to visit other pages, you need to make the following key settings.

Select "Thread Group"-- "right-click--" add-- "configuration component--" Http cookie Manager. After this step is added, the http request will have the cookie function, that is, visiting other pages after a successful login will not jump to the login page and log in again.

7. Repeat stress tests on the target page.

7.1 how to make the tested page visit repeatedly to achieve the effect of pressure measurement. Select "Thread Group"-"right-click"-"Logic Controller -" Loop Controller. Select "forever" in the number of cycles.

Select the "Loop Controller" you just added, right-click-- "add--" sampler-- "http request, set the ip and port in 4 steps, the http request method is" get ", and the path is the url under stress test, such as" exam/business/studentExam.action.StudentExamAction?action=goIntoMockExam ".

After pressing the above settings, the configuration has been completed and the stress test can be done. Just click the menu "run"-start, that is, run the stress test.

8. Jmeter provides a number of tools to view stress results. It is a very good analysis tool for stress testing. The following viewing tools can be selectively added.

8.1 look at the result tree. He records the data sent by each request and returns the data in response. Select "Thread Group"-- "right-click--" add-- to view the result tree.

8.2 use a table to view the results. You can view the response time of each request, etc. Select "Thread Group"-- "right-click--" add-- to view the results in a table.

8.3 Summary Report . You can view the average response time, maximum response time, and so on.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report