JMeter的下載以及安裝使用

下載 

https://jmeter.apache.org/download_jmeter.cgihtml

 

安裝

無須安裝,解壓以後便可使用。java

解壓到C:\Program Files\apache-jmeter-5.1目錄下(沒法直接解壓,先在D盤解壓,而後複製到C盤裏面)。apache

運行以後,一閃而過,沒有出現UI。瀏覽器

須要注意的是:啓動bat文件最好用管理員權限,不然個人使用路徑是系統盤,會出現log文件不能寫的問題cookie

問題排查

註釋掉jmeter.bat文件中的第一行,rem @echo off,而後運行以下命令,能夠看到錯誤:工具

C:\Program Files\apache-jmeter-5.1\bin [master +0 ~1 -0 !]> .\jmeter.bat >>launch.log
java.lang.Throwable: Could not access C:\Program Files\apache-jmeter-5.1\lib
at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.Throwable: Could not access C:\Program Files\apache-jmeter-5.1\lib\ext
at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.Throwable: Could not access C:\Program Files\apache-jmeter-5.1\lib\junit
at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.ClassNotFoundException: org.apache.jmeter.JMeter
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.jmeter.NewDriver.main(NewDriver.java:250)
JMeter home directory was detected as: C:\Program Files\apache-jmeter-5.1post

 解決:發現是lib文件夾沒有複製成功緻使的,以前複製文件夾的時候,提示lib被佔用。因此沒有複製成功。網站

 

PluginsManager

https://jmeter-plugins.org/wiki/PluginsManager/ ui

安裝

https://jmeter-plugins.org/install/Install/this

The easiest way to get the plugins is to install Plugins Manager. Then you'll be able to install any other plugins just by clicking a checkbox.

Download plugins-manager.jar and put it into lib/ext directory, then restart JMeter.  

 proxy

Plugins Manager respects JMeter's proxy settings. However, to avoid editing the properties files, we recommend to launch JMeter with additional parameters to pass it the proxy settings:

JVM_ARGS="-Dhttps.proxyHost=myproxy.com -Dhttps.proxyPort=8080" jmeter\bin\jmeter.bat

If you need proxy username/password, specify them with two additional properties http.proxyUser and http.proxyPasslike this:

JVM_ARGS="-Dhttps.proxyHost=myproxy.com -Dhttps.proxyPort=8080 -Dhttp.proxyUser=john -Dhttp.proxyPass=***" jmeter\bin\jmeter.bat

在system.properties文件中配置代理

So if you don't wish to set both http and https proxies, you can define the relevant properties in system.properties instead of using the command-line parameters.

https://stackoverflow.com/questions/52084212/how-to-manage-proxy-in-jmeter

You can configure JMeter to use proxy in 2 ways:

  1. Command-line

    jmeter -H your_proxy_host -P your_proxy_port
  2. Using system.properties (the file lives under "bin" folder of your JMeter installation, add the next lines to it:

    http.proxyHost=your_proxy_host
    http.proxyPort=your_proxy_port
    https.proxyHost=your_proxy_host
    https.proxyPort=your_proxy_port

    JMeter restart will be required to pick the properties up. 

 須要注意的是,http.proxyHost=http://    這裏須要加http://

unable to find valid certification path to requested target

https://www.cnblogs.com/chucklu/p/10445580.html

 

在jmeter.properties配置

# CookieManager behaviour - should Cookies be stored as variables?
# Default is false
CookieManager.save.cookies=true

 

407錯誤,代理須要受權

給代理配置上帳戶,這裏的帳號和密碼。密碼若是有特殊字符,須要先進行一次urlencode【密碼中的@會被轉換成%40】

 http://帳號:密碼@域名(ip):端口號

 

 總結

  • 使用的proxy必須加上http://的前綴
  • 使用的proxy必須配置帳戶和密碼

         建議在bin\ system.properties文件末尾添加以下兩行

          http.proxyHost=http://域帳號:密碼(url encode以後的) @proxy:port

         http.proxyPort=8080

      參考https://blog.csdn.net/c5113620/article/details/80384660

  • 將證書導入Java的證書驗證系統(Java的證書驗證系統是獨立於操做系統和瀏覽器的,而是使用JRE中證書庫,全部必須把代理工具的證書加入到JRE的證書庫中。)

       https://blog.csdn.net/write_down/article/details/79114573

 

 

 

https://www.blazemeter.com/blog/how-to-configure-jmeter-logging

相關文章
相關標籤/搜索