Jmeter series (1) - environment deployment, detailed introduction of Jmeter, introduction of Jmeter installation directory, introduction of Jmeter panel, explanation of common configuration items of jmeter.properties

Environment deployment

Official website to download Jmeter

http://jmeter.apache.org/Download the latest version of JMeter, unzip the file to any directory

Install JDK, configure the Java environment [directly go to the environment variable configuration] [mac]

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/

CLASSPAHT=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

PATH=$JAVA_HOME/bin:$PATH:

export JAVA_HOME

export CLASSPATH

export PATH

Note: JDK installation path should be avoided, Jmeter path has Chinese and spaces

 Configure Jmeter environment variables [mac]

export JMETER_HOME=/Users/ww/Downloads/apache-jmeter-5.5
export PATH=$JAVA_HOME/bin:$PATH:.:$JMETER_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JMETER_HOME/lib/ext/ApacheJMeter_core.jar:$JMETER_HOME/lib/jorphan.jar:$JMETER_HOME/lib/logkit-2.0.jar

Check if Jmeter configuration is successful

Detailed introduction of Jmeter

What test scenarios does Jmeter support?

Jmeter is capable of load testing and performance testing many different application/server/protocol types

  1. Web - HTTP, HTTPS (Java, NodeJS, PHP, ASP.NET, …)
  2. SOAP / REST Webservices
  3. FTP
  4. Connect to the database through JDBC (support various databases)
  5. LDAP
  6. Message-Oriented Middleware (MOM) via JMS
  7. Email Protocols - SMTP(S), POP3(S) and IMAP(S)
  8. Native commands or shell scripts
  9. TCP
  10. Java Objects

What are the characteristics of Jmeter?

  • Full-featured test editing interface, allowing quick recording of test plans (from browser or native application), building and debugging  [HTTP proxy server, similar to packet capture]
  • The command line mode can be tested on any system (win, linux, mac) with Java environment installed [good portability]
  • Provides complete and ready-to-view HTML reports
  • Data can be extracted and associated in most popular response formats (HTML, JSON, XML or any text format) [often referred to as data association]
  • A multi-threaded framework allows concurrent sampling by multiple threads, and simultaneous sampling of different methods by separate thread groups.
  • Test results can be cached, analyzed offline, and replayed offline

Where is the scalability of Jmetert?

  • Scripted sampler [BeanShell, Groovy]
  • Samplers that can be added or deleted at will
  • Load statistics can add and delete timers
  • Data analysis and visualization plugins provide excellent extensibility and personalization
  • JMeter's own methods can provide dynamic input or data processing capabilities to the test plan
  • Easy continuous integration with third-party open source libraries for Maven, Gradle, and Jenkins.

Jmeter actual usage scenarios

  • interface test
  • pressure test
  • Distributed stress testing
  • Test Restful API

Jmeter installation directory introduction

Jmeter installation directory description

mac

win

bin
  • Contains commands related to startup, configuration, etc.
  • The script written by yourself is saved as this directory by default
docs Official interface documents, some interfaces that need to be understood for secondary development
extras Auxiliary library, which will be used in continuous integration (later)
lib
  • Store the source jar packages of various Jmeter core libraries
  • Store your own secondary development jar package
lib\ext Officially provided third-party plug-ins
license Includes license for non-ASF software
printable_docs Offline help documentation, you can view functions and other content
LICENSE JMeter License Notes
NOTICE JMeter simple message description
README.md JMeter official basic introduction

Focus on the bin directory

 

document effect
jmeter.properties JMeter core configuration file, various configurations are basically done here
log4j.conf JMeter log configuration management
jmeter.log JMeter running log records, what output information, warnings, and errors are all recorded here
jmeter.bat The startup file of jmeter under windows , with cmd window
jmeterw.cmd The startup file of jmeter under windows , without cmd window
shutdown.cmd Close file of jmeter under windows
stoptest.cmd jmeter stop test file under windows
jmeter-server.bat The startup file of jmeter server mode under windows
jmeter-server The startup file used by mac or Linux distributed pressure test

Jmeter panel introduction [important]

Jmeter panel introduction

Talk about the commonly used menu bar

Related to distributed operation, I will explain it later.

Options, you can open the log, modify the language, and manage plug-ins!

 Tools, mainly look at function assistants

 

 Next, commonly used icons

 

 From left to right are

  • New Test Plan
  • Select a test plan template to create a new test plan
  • open jmeter script
  • save jmeter script
  • to cut
  • Copy (bad, not as good as ctrl+c)
  • paste
  • expand tree
  • Collapse the directory tree
  • Disable or enable components
  • The machine starts running the current test plan
  • Immediately start running the current test plan locally
  • stop
  • closure
  • to clear
  • clear all
  • look up
  • Clear Find
  • Function helper dialog
  • help

view log

  • If it is a yellow exclamation mark, it is normal. If it is a red number, it means there is a problem [how many numbers are displayed, and the number of warnings/errors is how many]
  • Click to view the log [this log is the log of the Jmeter tool using the loading information, not the log of the test script running]

View bug report

jmeter will record warn and error information in the jmeter.log file, and jmeter.log is in the bin directory

key point

  • If the execution result of the test script is not what you want, you can try to find it in jmeter.log, for example: call the function but the syntax is wrong
  • Of course, Sampler error results are generally not recorded in jmeter.log, for example: request 404

jmeter.properties [said in the bin of this chapter] [you can see this for details]

The bin directory under the jmeter installation directory

Is the Jmeter core configuration item file

official advice

Copy and paste the property value that needs to be modified to user.properties in the same directory 

Benefit: When Jmeter is upgraded, it can avoid the need to reapply the modified items

Common configuration

Official documentation: Apache JMeter - User's Manual: Properties Reference

default language setting

  • language=en: default English
  • language=zh_CN: default Chinese

Note: This will only take effect if declared in the jmeter.properties file, the official also reminded

Configure the default encoding format

  • sampleresult.default.encoding=ISO-8859-1: Default ISO-8859-1
  • sampleresult.default.encoding=UTF-8: can be changed to commonly used UTF-8

Output test report template format 

jmeter.save.saveservice.output_format=csv

catch cookie

Cookies should be stored as variables

CookieManager.save.cookies=false: default

CookieManager.save.cookies=true: store cookies as variables

Shortcut (ctrl+number 0-9)

  • gui.quick_0=ThreadGroupGui
  • gui.quick_1=HttpTestSampleGui
  • gui.quick_2=RegexExtractorGui
  • gui.quick_3=AssertionGui
  • gui.quick_4=ConstantTimerGui
  • gui.quick_5=TestActionGui
  • gui.quick_6=JSR223PostProcessor
  • gui.quick_7=JSR223PreProcessor
  • gui.quick_8=DebugSampler
  • gui.quick_9=ViewResultsFullVisualizer

post request, if the Content-Type is not added, the Content-type will not be added by default

The default is true before version 5.0

post_add_content_type_if_missing=false: default

post_add_content_type_if_missing=true:添加Content-Type: application/x-www-form-urlencoded

Configure the remote host host 

remote_hosts=127.0.0.1

Guess you like

Origin blog.csdn.net/qq_41663420/article/details/129841445