In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
It is often necessary to perform a large concurrent stress test on a case in the process of performance testing, but you only need to log in once. Jmeter comes with a controller only once, but this controller is meaningful only for a single thread. Under multithreading, how many threads will be set or how many times will be executed for 1000 concurrent users, the system will still perform 1000 logins, and 10 logins will fail, which will affect the results of the actual stress test cases. This article introduces how to use global variables to achieve a real login only once.
I. request analysis
This time, you need to test the performance of a query operation of the system. First, log in to the system using Google browser, press F12 to enter the debugging page, and then visit the query page. The following picture shows the address of the query interface.
The following figure shows the information header of the API. As can be seen from the figure, you need to log in to obtain the Cookie and declare the Cookie in the query request header to realize the query operation.
II. Script development
This time, you need to develop a login script. As you can see from the following figure, the MOD_AUTH_CAS variable will be returned in the sub-request (redirect) of the login 1 request.
Just add a regular expression extractor to the request, as shown in the following figure
The MOD_AUTH_CAS variable was extracted successfully. We just need to declare the variable as a global variable with beanshell after the request, so that other threads can also call the variable.
Under the query thread group, declare the information header and define the cookie field, which is called using MOD_AUTH_CAS=$ {_ P (Th_MOD_AUTH_CAS,)}, as shown in the following figure
III. Multithreaded verification
First, set the thread group to 2 threads and 2 loops to see if it can be executed properly.
Set up the test plan, check the test plan to run each thread group independently, and put the login thread group at the front, so that the system will log in first and execute other thread groups
Execute the script, as shown in the following figure, the system only logged in once, 4 queries were performed normally, and 2 threads executed 2 loops for 4 queries.
This paper introduces how to use Cookie authentication to log in once and perform stress testing under multiple concurrency. If the system calls token, the rules are the same, and you only need to globalize the token.
if the article is helpful to you, you are welcome to follow my official account, which is synchronized with the articles on this platform for easy reference. I will continue to publish articles related to testing and share testing techniques with you. Every original article is written attentively to put an end to plagiarism.
QQ technology exchange group: please enter the verification information 51cto to add the group.
Wechat QR code follow official account:
After following, reply to the resource download, and you can get the download address of all kinds of resources shared by yourself.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.