In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Before the official account tweets to share how to test the interface, in fact, ignored some conceptual things, today to make up for the deficiencies, do a review.
one。 JMeter introduction
What jmeter can do, explained from the official website:
Ability to load and performance test many different applications/server/protocol types:
Web-HTTP, HTTPS (Java, NodeJS, PHP, ASP.NET...)
SOAP / REST Webservices
FTP
Database via JDBC
LDAP
Message-oriented middleware (MOM) via JMS
Mail-SMTP (S), POP3 (S) and IMAP (S)
Native commands or shell scripts
TCP
Java Objects
Jmeter can simulate a large number of load test networks or objects. JMeter is an application developed in Java language, which consumes memory and CPU. When simulating large concurrent users, a single simulation is somewhat inadequate. At the same time, jmeter can help us do regression testing and verify the expected values returned by the program through test scripts and assertions.
Comparison of JMeter and LR:
Jmeter is an open source testing tool organized by apache (not very handsome). Compared with LR, it has many disadvantages, but it has many advantages, which makes countless test engineers give up the pompous and pompous LR (although very handsome, but too many functions, difficult to use).
Open source means free
Small, compared to the size of LR (several G installation packages), jmeter is very small, does not need to be installed, only the java environment
Powerful, a simple web performance testing tool, constantly update and expand, can complete DB, FTP, LDAP, webservice, TCP and other tests, but also free to expand rich plug-ins.
Cross-platform, can run on any system, Linux, Unix, Mac os, Ubuntu, centos, windows and so on.
LR operating environment can not be separated from windows, and is a commercial fee-based software.
Disadvantages:
Jmeter does not support IP spoofing, LR supports it.
Results the ability of analysis was not detailed enough compared with LR.
II. Download and install Jmeter
1) installation
Download the jmeter version on the official website: http://jmeter.apache.org/
Jdk1.8 environment is required for jmeter versions later than 3.2,
2) plug-in installation
Download the plug-in and go to the% jmeter_home%/lib/ext directory. Restart jmeter will take effect.
3) run jmeter
1. Go to the bin directory and run jmeter
In windows environment, enter the jmeter/bin directory and jmeter.bat can run jmeter.
For Mac os, Ubuntu and other environments, enter the jmeter/bin directory and click jmeter to run jmeter
two。 Language choice
Menu: options-> Select language-> Select your favorite language
3. ClassPath
If the self-developed jar package is used in jmeter, the method is the same as the plug-in, placed in the lib/ext directory
III. Jmeter Test Plan
1) test plan
Open jmeter and create a test plan by default
Instructions from the official website to create a variety of test plan
2) Threads
Setup Thread Group
Is all the preparatory work before really starting thread concurrency, which must be completed before the thread group starts and has its own independent thread settings; setUp Thread Group is similar to lr's init. Can be used to perform pre-test operations.
Teardown thread group
Is a thread group that executes periodically after the completion of all thread execution tests. Have your own independent thread settings
TearDown Thread Group is similar to end of lr. Can be used to perform post-test actions.
Thread group
We usually add running threads. It can be thought of as a virtual user group, and each thread in the thread group can be understood as a virtual user. The number of threads contained in a thread group does not change during test execution.
Ramp-Up Period (in seconds) means that all threads are created within this time. If there are 3 threads, Ramp-Up=10 seconds, then the thread startup time interval is 10Accord 3 seconds 3.33 seconds. The advantage is that there will not be too much load on the server at first, and thread groups are designed to simulate concurrent load.
Number of loops: indicates how many requests are executed per thread
3) template
Templates are a very useful feature
Click on the template, jmeter GUI has booked a variety of test plan for you, choose a type you need, and what you see is the content in the creation thread group. All you have to do is fix it.
This way saves us a lot of time.
4) Sampler
We are very familiar with this, HTTP Request Sampler, FTP Request Sampler, TCP Request Sampler, JDBC Request Sampler and so on. Each different type of sampler can send different types of requests to the server according to the set parameters, including two special sampler, java sampler and Beanshell sampler.
5) Timer
The timer is used to set the waiting time. Wait time is a common means to control client QPS/TPS in performance testing. Similar to the "thinktime" in LoadRunner. JMeter defines different types of Timer, such as Bean Shell Timer, Constant Throughput Timer, fixed timer, and so on.
6) Pre-Processor Elements
It means the pre-processor, which is used to process the sampler and is executed before the sampler starts, which is different from the post processor, such as the user parameter beanshell PreProcess, etc.
7) Post-Processor Elements
In the course of testing, it is often necessary to find some parameters from the response data as parameters for the next request, so post-processors such as regular expressions, json samplers and beanshell PostProcess are needed.
8) Assertions
Assertions don't need to be introduced, we often use them, and jmeter provides a wealth of assertions that can be combined.
9) Listeners
The listener provides a lot of rich result information, including graphical and digital, is a series of components used to process and visually display the test result data. Graphical results, viewing the result tree, aggregating reports, and viewing results in tables are all components that we often use.
10) Configuration Elements
Configuration components, such as csv data elements, http information management header, http cookie manager, user-defined variables, counters, random variables, etc., all belong to configuration components.
Configuration components often appear in our thread group, for example, the received cookie can be stored as a JMeter thread variable. To save cookie as a variable, define the property "cookiemanager .save.cookie = true"
11) Execution order
Order of execution, explanation from the official website
Configuration elements
Pre-Processors
Timers
Sampler
Post-Processors (unless SampleResult is null)
Assertions (unless SampleResult is null)
Listeners (unless SampleResult is null)
12) Properties and Variables
Attributes and variables. The properties of jmeter are defined in jmeter.properties. The scope of this attribute is global, and users can also customize variables.
13) jmeter command line
Jmeter-n-t [jmx file]-l [results file]-e-o [Path to web report folder]
& increase Java Heap to meet your test requirements:
Modify current env variable HEAP= "- Xms1g-Xmx1g-XX:MaxMetaspaceSize=256m" in the jmeter batch file
Check: https://jmeter.apache.org/usermanual/best-practices.html
Today's featured recommendation
JMeter Interface Test-if Controller
JMeter database operation
Jmeter Interface Test-regular expression
JMeter returns garbled code in Chinese
Jmeter interface testing-parameterization
JMeter Interface testing-Basics
Test-impression
Add Wechat to the consulting work
scan a QR code
Welcome self-recommendation and recommendation, need Wechat to push resume!
Please poke the QR code below to learn more.
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.