Test learning-115-Install the jmeter tool on Linux to run the jmx script written by Windows

Foreword:

     We have already met, use the jmeter tool on windows to write our scripts and record our scripts. But in the actual process of real software projects. We often encounter multiple test tasks, if jmeter occupies the memory and CPU of our local computer. We can't perform other testing tasks well. In an enterprise, there is usually a Linux server, and we put the script we wrote on the Linux server for execution, and then our own local computer to do extra work, parallel testing, free your hands, and improve efficiency.

Purpose: Use Linux to run scripts written on your own windows, release your own computer's resources, and save time in parallel testing.

1. Install jmeter under Linux

There are many installation tutorials on the Internet, here I also refer to a few:

http://www.manongjc.com/detail/12-zsrstmmcasnykuu.html

Download the Jmeter installation package

Official website download address:

Download address of the latest version: https://jmeter.apache.org/download_jmeter.cgi
Download address of historical version: https://archive.apache.org/dist/jmeter/binaries/

Install the Java environment. The running of the jmeter script depends on the Java environment. So install Java in advance. We have already had it before, and you can view the tutorial on installing Java on Linux.

https://blog.csdn.net/u013521274/article/details/109539711

1. Download the apache-jmeter-5.1.1.tgz file. 

2. Place the file in the linux directory, for example: under /lyjmeter

3. Unzip apache-jmeter-4.0.tgz to the current folder

[root@test /]# cd /lyjmeter
[root@test local]# tar -zxvf apache-jmeter-4.0.tgz

4. After the decompression is complete, configure the jmeterde environment variables.

 ①Edit profile file

vim /etc/profile

② At the end of the file, add environment variables, be sure to pay attention to the Java directory must be correct.

export JAVA_HOME=/home/download/jdk
export JRE_HOME=/home/download/jdk/jre
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export JMETER_HOME=/lyjmeter/apache-jmeter-4.0
export CLASSPATH=$JMETER_HOME/lib/ext/ApacheJMeter_core.jar:$JMETER_HOME/lib/jorphan.jar:$JMETER_HOME/lib/logkit-2.0.jar:$CLASSPATH
export PATH=$JMETER_HOME/bin:$PATH:$HOME/bin

③After adding, execute the profile file

[root@root /]# source /etc/profile 

5. After the file configuration is complete, check whether jmeter is installed successfully.

[root@root/]# jmeter -v

If the following picture appears, the installation is successful.

 

 Second, execute the jmx file

1. Create a new jmx folder under current, and copy the jmx file in windows. The jtl directory stores the test results, and a new html folder is created to store the test results.

[root@host31 lyjmeter]# /lyjmeter/apache-jmeter-4.0/bin/jmeter -n -t /lyjmeter/jmx/test2.jmx -l /lyjmeter/jtl/test2.jtl -e -o /lyjmeter/html/

As shown in the above code line, test2.jmx represents the script. test2.jtl represents the generated result, and the test report converted into html is stored in the HTML directory.

Remarks : During the execution of the script, the server can no longer execute other commands. It must wait for execution until the result is over.

If you are interested, you can give it a try. You can use the nohup command, which allows the script to be executed in the background.

We copy the results of the previous play from the html directory. Then open it on windows and you can see a very beautiful test report. As shown below

Well, today's article about jmeter running scripts on Linux is over.

If you have any questions, you can leave a message, and you must reply when you see it.

 

 

 

 

Guess you like

Origin blog.csdn.net/u013521274/article/details/114848800