Getting started with Jmeter

Jmeter basics (detailed installation steps)

 

.

Jmeter learning

 

.Jmeter Introduction

. The basic concepts (from Baidu Encyclopedia)

Apache JMeter is a Java-based stress testing tool developed by the Apache organization. Used for stress testing of software. It was originally designed for web application testing, but later expanded to other testing areas. It can be used to test static and dynamic resources, such as static files, Java servlets, CGI scripts, Java objects, databases, FTP servers, etc. JMeter can be used to simulate huge loads on servers, networks or objects, test their strength under different stress categories and analyze overall performance. In addition, JMeter can perform functional/regression testing of the application, by creating a script with assertions to verify that your program returns the results you expect. For maximum flexibility, JMeter allows the use of regular expressions to create assertions.

.Jmeter advantages

1. Open source and free, written based on Java, can be integrated into other systems, and can extend various functional plug-ins

2. Support interface test, stress test, etc. Support recording and playback, easy to get started

3. Multi-platform support, can run on Linx, windows, Mac

.Jmeter installation and configuration

Installation and configuration under .windows system (here I choose version 4.0)

Download URL http://jmeter.apache.org/download_jmeter.cgi

JAVA download URL

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

At this time, unzip the downloaded Jmeter compressed package to where you want to put it. Java needs to be installed manually and installed under the drive letter of the installation you want. Basically, except for the next step, you need to modify other things. The next step is Configure environment variables.

1. Right-click on my computer, select properties, go to the control panel properties window, click "advanced system settings"-environment variables, open the environment variables window

2. Create a new variable name in the system variables: JAVA_HOME
Variable value: C:\Program Files\Java\jdk1.8.0_171 (The variable value is filled in according to your own location)

3. Find Path edit in system variables
Variable name: Path
variable value: C:\Program Files\Java\jdk1.8.0_171\bin

4. Create a new (copy directly)
variable name in the system variables : CLASSPATH
variable value: .;%JAVA_HOME%lib;%JAVA_HOME%lib\tools.jar; (remember the previous.)

Win + R shortcut key to open and run, enter cmd to open the panel, enter java -version in the panel, the following message appears, that is, jdk has been installed

Jmeter environment variable configuration

6. Add to PATH
%JMETER_HOME%\lib\ext\ApacheJMeter_core.jar;%JMETER_HOME%\lib\jorphan.jar;%JMETER_HOME%\lib\logkit-2.0.jar;

7. Create a new JMETER_HOME

Variable name: JMETER_HOME

Variable value: E:\apache-jmeter-4.0\apache-jmeter-4.0 (according to your own location)

8. This is the configuration, enter E:\apache-jmeter-4.0\apache-jmeter-4.0\bin (open according to your own location) and open the jmeter.bat file, then two pop-up windows will appear , One is the windows window, the other is the test interface we use for Jmeter (remember that the pop-up window command window cannot be closed)

. Problems in the installation and configuration of Jmeter :

1. After configuration, open jmeter.bat and it will appear as shown in the figure

Solution: (Generally speaking, I have tried method 1, and Baidu will come later. Please correct it if there is something wrong)

Solution 1: Add .%SystemRoot%\system32;%SystemRoot%;%JAVA_HOME%\bin; (It is better to restart after configuration) If it still exists after restart, continue

Solution 2: Path search order problem. Find the windows and system32 directories and find that there is a java.exe in the system32 directory. Before putting JAVA_HOME in the system-related configuration, it will first go to the configured java environment to find it. If there are more, please continue:

Solution three: JDK 32-bit and 64-bit problems, the computer is 64-bit, the installed JDK is 32-bit, reinstall the 64-bit JDK, configure the environment variables, and then run jmeter.bat. If it still exists after the operation, please continue:

Solution four: jmeter.bat configuration file problem, the problem is solved. It turns out that java is configured in the configuration file at the same time, the configuration item is rem, and the startup is ok.


2. After configuring and opening jmeter.bat, there will be a flashback phenomenon. Because of the problem of the flashback, the screenshot cannot be taken, so the screenshot cannot be taken.

Solution: Right-click and edit jmeter.bat, and then add pause at the end of the code to stop this phenomenon (available for pro-test)

3. After the configuration is completed, the jmeter.bat will appear as shown in the figure (the figure found on the Internet, this problem has really occurred by itself) 

Solution: delete the JMETER_HOME in the environment variable and click to run again

jmeter.bat is fine , this problem is because version 4.0 can automatically generate this JMETER_HOME when running on some computers (available for pro-testing, but it is recommended to accompany this first to avoid other problems during installation)

1. Appears after running jmeter.bat (this hasn't happened by borrowing pictures to say things...)

Solution: Add .%SystemRoot%\system32;%SystemRoot%;

Sinicization of .Jmeter :

In this way, it is switched to the state of simplified Chinese. Of course, it will be restored to the English state after it is closed. The Chinese package has not been found yet.

.Jmeter commonly used file types:

The file type of Jmeter is jmv, in fact the file type is xml type file. E.g:

Create a new thread group, save it, then modify the extension and open it as shown above.

Jmeter operating mode and parameters

GUI model

Open an existing jmx file (file-open)

Click the start button to run

Since the GUI mode itself has an interface, there is also a Chinese version, so I won’t introduce it in detail here.

Command line mode

Depends on 1. Configure the jmeter environment variable (in Windows, add ${jmeterhome}/bin to the path variable) 2. If there is no environment variable, directly give the full path when executing or execute it under ${jmeterhome}/bin.

命令jmeter -n -t <testplan filename> -l <listener filename>

Parameters : -h help -> print out useful information and exit

-nNon  -GUI mode -> Run JMeter in non-GUI mode

-t  test file -> JMeter test script file to run

-l jtl file -> file to record the results

-r  remote execution -> start remote service

-H  proxy host -> set the proxy host used by JMeter

-P  proxy port -> set the port number of the proxy host used by JMeter  

-j log file -> set the name of the JMeter log file

          
To be continued. . . . (Neck hurts, rest well before continuing)

 

Guess you like

Origin blog.csdn.net/qq_34194159/article/details/80954934