当前位置:网站首页>Basic use of JMeter to proficiency (I) creation and testing of the first task thread from installation
Basic use of JMeter to proficiency (I) creation and testing of the first task thread from installation
2022-07-07 09:45:00 【qq_ thirty-six million nine hundred and sixty-seven thousand an】
( One )jemter Introduce
Apache JMeter yes 100% pure JAVA Desktop applications , Designed to test clients / Server side structure software ( for example web Applications ). It can be used to test the performance of static and dynamic resources , for example : Static files ,Java Servlet,CGI Scripts,Java Object, Database and FTP Servers and so on .JMeter Can be used to simulate a large load to test a server , Robustness of network or object or analysis of overall performance under different loads .
meanwhile ,JMeter Can help you regression test your application . Through the test scripts you create and assertions To verify that your program returns the expected value . For better adaptability ,JMeter Allow to call secondary development of jar Package to enrich your test scenarios ;JMeter Allows you to use regular expressions to create these assertions.
But use JMeter Can't verify JS Program , You can't verify the page either UI, So you need to talk to Selenium Cooperate to complete Web2.0 Application testing .
( Two )
1.http://jmeter.apache.org/ Download the latest version of JMeter, Unzip the file to any directory
2. install JDK, Configure environment variables JAVA_HOME
JDK Environment variable configuration gate
3. System requirements :JMeter2.11 need JDK1.6 The above version supports running
4.JMeter Can run on the following operating systems :Unix,Windows and Open VMS.
JMeter Plug in installation
Plug in download address : http://jmeter-plugins.org/downloads/all/
Download the plug-in and unzip it : find JMeterPlugins-Extras.jar, hold JMeterPlugins-Extras.jar Put it in apache-jmeter-2.12\lib\ext Catalog .
5. Should be avoided jdk Path and jmeter The path has Chinese and spaces , Otherwise, there will be abnormalities , It can also cause problems with remote testing .
6. Get into bin Directory double click jmeter. bat Or configure environment variables to create JMETER_HOME,cmd Run in jmeter
( 3、 ... and )jmeter Directory structure
(1)backup Catalog Script backup directory , The documents inside are all in the form of .jmx The file at the end of the suffix
The directory does not exist after the actual installation and decompression , This is due to the use of JMeter after ,JMeter Automatically create this directory , Then I backed up the script file .
(2)bin Catalog Executable Directory
Jmeter.bat: It's startup jmeter The main script for .
Jmeter-server.bar: It is used to implement online load .
Jmeter.properties: yes jmeter The main configuration file , exceed 80% The configuration items are all implemented through this file .(PS: After modifying the configuration file , To restart Jmeter To take effect )
Jmeter.bat open Jmeter main interface
Jmeter The log file name used is defined to Jmeter.properties in , Default in Jmeter.log Check the log
(3)dosc Catalog
docs The files in the directory are JMeter Of Java Docs, and printable_docs Of usermanual The content in the subdirectory is JMeter User's manual documentation for , among component_reference.html Is the most commonly used core component help document . What is stored in this directory is jmeter Official document API file , It is mainly used for secondary development .
(4)extras Catalog
The files in this directory provide tools for building Ant Support for , have access to Ant To achieve test automation , For example, batch script execution , produce HTML Format report , Test run time , You can record the test data ,Jmeter It will automatically generate a .jtl file , Put the document in extras Under the table of contents , function “ant -Dtest= file name report”, You can generate test statistics report . It can also be used for continuous integration .
(5)lib Catalog
This directory contains two subdirectories , among ext Subdirectories contain JMeter At the heart of jar package , the other one junit Subdirectories store JUnit The test script . User extensions depend on packages , It should go straight to lib Under the table of contents , Instead of lib/ext Next .
Be careful : Can't recognize zip In the form of Bao Wenjian , Therefore, the required package files are required to be .jar ending
(6)Licenses jmeter Software license file directory
(7)printable_docs Catalog
This directory holds jmeter Official help documents .printable_docs Of demos There are some commonly used JMeter Script case , As a reference . Can print half version catalog .
(8)LICENSE JMeter —— License description
(9)NOTICE JMeter —— A simple message says
(10) README.md ——JMeter Official basic introduction
jmeter.properties The main content of the document is
# Default language settings
language=en
# capture cookie switch
CookieManager.save.cookies=true
# Configure the font and size of the editor
jsyntaxtextarea.font.family= Song style
jsyntaxtextarea.font.size=20
# Configure the default encoding format
sampleresult.default.encoding=UTF-8
#SSL To configure : Focus on the following configurations # Appoint HTTPS Protocol layer
# Appoint HTTPS Protocol layer
https.default.protocol=TLS
# Appoint SSL edition , It may need to be modified in practice
https.default.protocol=SSLv3
# Set the startup protocol
https.socket.protocols=SSLv2Hello SSLv3 TLSv1
# Cache control , control SSL Whether it can be reused in multiple iterations
https.use.cached.ssl.context=true
#JMeter Test project automatic backup configuration
# Set whether to enable automatic backup , The default is true jmeter.gui.action.save.backup_on_save=true
# Set up automatic backup directory , Backup to by default JMeter Root directory backups Next
jmeter.gui.action.save.backup_directory=# Set the number of automatic backup items , The default is recent 10 individual
jmeter.gui.action.save.keep_backup_max_count=10
# Remote host configuration
# Configure the remote host IP, Default to native . Comma "," You can set up multiple remote hosts remote_hosts=127.0.0.1
# Examples of multiple remote host assignments are as follows , among : After the port
remote_hosts=127.0.0.1:1099,127.0.0.1:1200,127.0.0.1:1300 about RMID
Please refer to the option description in the configuration file
# Log management configuration
# Format log log_format_type=default
# Set the log output level log_level.jmeter=INFO
# Set up junit Log output level log_level.jmeter.junit=DEBUG
# Set the log output target file , The default is jmeter.log log_file=jmeter.log
jmeter.bat Key configuration changes
# For better use jmeter, Need to be right jmeter.bat Some of the configurations in are optimized according to the current machine configuration , The key configuration items are described here , You can modify it according to the configuration of your machine .jvm Related configuration , In about 80 Row or so , Find these configurations , Modify the value according to the current hardware configuration of the machine .
set HEAP=-Xms2048m -Xmx2048m set NEW=-XX:NewSize=512m
-XX:MaxNewSize=512m set SURVIVOR=-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50% set TENURING=-XX:MaxTenuringThreshold=2 if %current_minor% LEQ “8” ( rem Increase MaxPermSize if you use a
lot of Javascript in your Test Plan : set PERM=-XX:PermSize=512m
-XX:MaxPermSize=1024m)
# Format output report template
jmeter.save.saveservice.output_format = csv
( Four ) Create the first thread

Here you can choose Chinese and English
(1) There can only be one test plan in a script , There must be at least one thread group in the test plan , At least one sampler ( Simulate user requests ), There has to be at least one listener ( Analyze system performance )
(2) Add thread group 
setup thread group: Pre execution before test
thread group( Thread group ): Generally speaking, a thread group , Think of it as a virtual user group , Each thread in a thread group can be understood as a virtual user . The number of threads in the thread group will not change during the test execution .
teardown thread group: Execute after test
Right click here to add a thread group thread group
(3) Set the number of threads
Set acceleration time
Set the number of times to execute the test 
Vernacular understood as 1 A thread executes once in a second , for example :
{
Concurrency number = Number of threads /Ramp-Up time* Number of cycles
Ramp-up That is, how many seconds to complete
Input in sequence 3,0,2
It's a cycle 2 Time
The order of execution is 1,1,2,2,3,3
The execution time of the loop is almost the same , for instance 1,1, The number of cycles is serial execution from the source code ( It's just a little similar to parallel execution )
When Ramp-up=0, Use the maximum capacity of the pressure test server to continuously send requests
}
(4) Controller and sampler
JMeter There are two types of controllers : Sampler and logic controller . Use these components to drive the test .
The sampler tells JMeter Send request to server . If you wish JMeter send out HTTP request , Then add a HTTP Request Sampler. You can also customize the request by adding one or more configuration elements to the sampler .
The logic controller allows you to customize JMeter The logic used to decide when to send a request . You can add one Interleave Logic Controller In two HTTP Request Samplers Alternate between .
Sampler can also be translated into sampler ; It is used to simulate the operation of the user , To the server ( The system under test ) issue Http request 、WebService(SOAP/XML-RPC Request) Request or Java Request etc. .
(5) Test a login 
View the result tree here , Successfully logged in 
Change password to login 
Login failed 
So far, the first simple test is completed . Similarly, Baidu can also be used here to test
You can get the request method through the developer tool 、 Request parameters to request
Or by fiddler、wireshark This packet capturing tool obtains , I don't want to describe it in detail
边栏推荐
- 第一讲:寻找矩阵的极小值
- C# XML的应用
- 如何成为一名高级数字 IC 设计工程师(5-2)理论篇:ULP 低功耗设计技术精讲(上)
- 战略合作|SubQuery 成为章鱼网络浏览器的秘密武器
- 印象笔记终于支持默认markdown预览模式
- Netease cloud wechat applet
- HCIP 第一天 笔记整理
- The difference between viewpager2 and viewpager and the implementation of viewpager2 in the rotation chart
- ViewPager2和VIewPager的区别以及ViewPager2实现轮播图
- 请教个问题,我用sql-client起了个同步任务,从MySQL同步到ADB,历史数据有正常同步过去
猜你喜欢

Elaborate on MySQL mvcc multi version control

How does mongodb realize the creation and deletion of databases, the creation of deletion tables, and the addition, deletion, modification and query of data

Switching value signal anti shake FB of PLC signal processing series

Information Security Experiment 1: implementation of DES encryption algorithm

Dynamics 365Online ApplicationUser创建方式变更
![[4g/5g/6g topic foundation-146]: Interpretation of white paper on 6G overall vision and potential key technologies-1-overall vision](/img/fd/5e8f74da25d9c5f7bd69dd1cfdcd61.png)
[4g/5g/6g topic foundation-146]: Interpretation of white paper on 6G overall vision and potential key technologies-1-overall vision

小程序实现页面多级来回切换支持滑动和点击操作

MongoDB怎么实现创建删除数据库、创建删除表、数据增删改查

Kubernetes cluster capacity expansion to add node nodes

First issue of JS reverse tutorial
随机推荐
Netease cloud wechat applet
信息安全实验二 :使用X-SCANNER扫描工具
面试被问到了解哪些开发模型?看这一篇就够了
VSCode+mingw64
**grafana安装**
MongoDB怎么实现创建删除数据库、创建删除表、数据增删改查
其实特简单,教你轻松实现酷炫的数据可视化大屏
shake数据库中怎么使用Mongo-shake实现MongoDB的双向同步啊?
Over 100000 words_ Ultra detailed SSM integration practice_ Manually implement permission management
基础篇:带你从头到尾玩转注解
如何成为一名高级数字 IC 设计工程师(5-2)理论篇:ULP 低功耗设计技术精讲(上)
Unity shader (basic concept)
The difference between viewpager2 and viewpager and the implementation of viewpager2 in the rotation chart
How to become a senior digital IC Design Engineer (1-6) Verilog coding Grammar: Classic Digital IC Design
How to become a senior digital IC Design Engineer (5-2) theory: ULP low power design technology (Part 1)
Dynamics 365Online ApplicationUser创建方式变更
2020CCPC威海 J - Steins;Game (sg函数、线性基)
网易云微信小程序
CMD startup software passes in parameters with spaces
12、 Sort