1.簡介
為什么宏哥要對Jmeter的配置文件進行一下講解了,因為有的童鞋或者小伙伴在測試中遇到一些需要修改配置文件的問題不是很清楚也不是很懂,就算修改了也是模模糊糊的。更有甚者覺得那是禁地神聖不可輕犯不敢觸碰不敢修改,害怕修改錯了Jmeter運行不了了。聽宏哥的大膽修改大不了再重新安裝一個新的Jmeter,或者你有做備份的好習慣,在修改前備份好以后大膽修改,修改錯了直接使用備份文件恢復過來就可以。
2.配置文件
在%JMETER_HOME%\bin(or $JMETER_HOME/bin)目錄下搜索框中輸入:properties 會發現存在多個配置文件,如下圖所示:
宏哥上一篇中對其中最重要的是jmeter.properties.是Jmeter核心配置項文件,進行了講解和說明,下面對其它常用的一些配置文件的設置進行總結與說明.按計划今天宏哥將要講解user.properties文件。
3.user.properties
這個文件不是很大,宏哥將其內容全部進行翻譯了一下,我們下邊看看其中到底含有那些配置項。
3.1文件說明
第1段——許可證說明
(1)原文
# Sample user.properties file
#
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership. ## The ASF licenses this file to You under the Apache License, Version 2.0 ## (the "License"); you may not use this file except in compliance with ## the License. You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable law or agreed to in writing, software ## distributed under the License is distributed on an "AS IS" BASIS, ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## See the License for the specific language governing permissions and ## limitations under the License.
(2)譯文
# 示例user.properties文件
#
## Apache軟件基金會(ASF)下一個或多個許可
## 貢獻者許可協議。請參閱
## 此作品用於獲取關於版權所有權的附加信息。
## ASF根據Apache 2.0 版本許可證協議將此文件授權給您。 ## (“許可證”);除非符合以下條件,否則不能使用此文件 ## 許可證。您可以在 ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## 除非適用法律要求或書面同意,軟件 ## 根據在“AS IS”BASIS上分發的許可證基礎上發布的, ## 無任何明示或暗示的保證或條件。 ## 有關管理權限的特定語言,請參閱許可證 ## 《許可證》規定的限制。
3.2類路徑配置
(一)第2段——用於搜索其他JMeter插件類的路徑列表
(1)原文
#---------------------------------------------------------------------------
# Classpath configuration
#--------------------------------------------------------------------------- # # List of paths (separated by ;) to search for additional JMeter plugin classes, # for example new GUI elements and samplers. # A path item can either be a jar file or a directory. # Any jar file in such a directory will be automatically included, # jar files in sub directories are ignored. # The given value is in addition to any jars found in the lib/ext directory. # Do not use this for utility or plugin dependency jars. #search_paths=/app1/lib;/app2/lib
(2)譯文
#---------------------------------------------------------------------------
# 類路徑配置
#--------------------------------------------------------------------------- # # 用於搜索其他JMeter插件類的路徑列表(由;分隔), # 例如,新的GUI元素和采樣器。 # 路徑項可以是jar文件或目錄。 # 這樣的目錄中的任何jar文件都將自動包含, # 忽略子目錄中的jar文件。 # 給定值是在lib/ext目錄中找到的任何jar之外的值。 # 不要將此用於實用程序或插件依賴項jar。 #search_paths=/app1/lib;/app2/lib
(二)第3段——搜索實用程序和插件依賴類的路徑列表
(1)原文
# List of paths that JMeter will search for utility and plugin dependency classes.
# Use your platform path separator (java.io.File.pathSeparatorChar in Java) to separate multiple paths. # A path item can either be a jar file or a directory. # Any jar file in such a directory will be automatically included, # jar files in sub directories are ignored. # The given value is in addition to any jars found in the lib directory. # All entries will be added to the class path of the system class loader # and also to the path of the JMeter internal loader. # Paths with spaces may cause problems for the JVM #Example for windows (; separator) #user.classpath=../classes;../lib;../app1/jar1.jar;../app2/jar2.jar #Example for linux (:separator) #user.classpath=../classes:../lib:../app1/jar1.jar:../app2/jar2.jar
(2)譯文
# JMeter將搜索實用程序和插件依賴類的路徑列表。
# 使用您的平台路徑分隔符(Java中的java. Io.Fiel.PosialStutoRealar)來分離多條路徑。
# 路徑項可以是jar文件或目錄。
# 這樣的目錄中的任何jar文件都將自動包含,
# 忽略子目錄中的jar文件。
# 給定的值是在lib目錄中找到的任何jar之外的值。
# 所有條目都將添加到系統類加載器的類路徑
# 以及JMeter內部加載程序的路徑。
# 帶有空間的路徑可能導致JVM的問題
#示例 Windows(分離器)
#user.classpath=../classes;../lib;../app1/jar1.jar;../app2/jar2.jar #示例 linux (分離器) #user.classpath=../classes:../lib:../app1/jar1.jar:../app2/jar2.jar
(三)第4段——搜索實用程序的路徑列表
(1)原文
# List of paths (separated by ;) that JMeter will search for utility
# and plugin dependency classes.
# A path item can either be a jar file or a directory.
# Any jar file in such a directory will be automatically included, # jar files in sub directories are ignored. # The given value is in addition to any jars found in the lib directory # or given by the user.classpath property. # All entries will be added to the path of the JMeter internal loader only. # For plugin dependencies using plugin_dependency_paths should be preferred over # user.classpath. #plugin_dependency_paths=../dependencies/lib;../app1/jar1.jar;../app2/jar2.jar
(2)譯文
# JMeter將搜索實用程序的路徑列表(由;分隔)
# 以及插件依賴類。
# 路徑項可以是jar文件或目錄。
# 這樣的目錄中的任何jar文件都將自動包含,
# 忽略子目錄中的jar文件。
# 給定值是在lib目錄中找到的任何jar之外的值
# 或者由user.classpath屬性給出。
# 所有條目將僅添加到JMeter內部加載程序的路徑。
# 對於插件依賴關系,應該優先使用 plugin_dependency_paths
# user.classpath.
#plugin_dependency_paths=../dependencies/lib;../app1/jar1.jar;../app2/jar2.jar
3.3報告配置
(一)第5段——標題
(1)原文
#---------------------------------------------------------------------------
# Reporting configuration
#---------------------------------------------------------------------------
(2)譯文
#---------------------------------------------------------------------------
# 報告配置
#---------------------------------------------------------------------------
(二)第6段——更改報表標題
(1)原文
# Configure this property to change the report title
#jmeter.reportgenerator.report_title=Apache JMeter Dashboard
(2)譯文
# 配置此屬性以更改報表標題
#jmeter.reportgenerator.report_title=Apache JMeter Dashboard
(三)第7段——根據日期范圍生成報告
(1)原文
# Used to generate a report based on a date range if needed
# Default date format (from SimpleDateFormat Java API and Locale.ENGLISH) #jmeter.reportgenerator.date_format=yyyyMMddHHmmss # Date range start date using date_format property #jmeter.reportgenerator.start_date= # Date range end date using date_format property #jmeter.reportgenerator.end_date=
(2)譯文
# 如果需要,可用於根據日期范圍生成報告
# 默認日期格式 (來自 Java API 和 Locale.ENGLISH 的日期格式)
#jmeter.reportgenerator.date_format=yyyyMMddHHmmss # 日期范圍開始日期使用 date_format 屬性 #jmeter.reportgenerator.start_date= # 日期范圍結束日期使用 date_format 屬性 #jmeter.reportgenerator.end_date=
(四)第8段——更改隨時間變化的圖的粒度
(1)原文
# Change this parameter if you want to change the granularity of over time graphs.
#jmeter.reportgenerator.overall_granularity=60000
(2)譯文
# 如果希望更改隨時間變化的圖的粒度,請更改此參數。
#jmeter.reportgenerator.overall_granularity=60000
(五)第9段——更改響應時間分布的粒度
(1)原文
# Change this parameter if you want to change the granularity of Response time distribution
# Set to 100 ms by default #jmeter.reportgenerator.graph.responseTimeDistribution.property.set_granularity=100
(2)譯文
# 如果希望更改響應時間分布的粒度,請更改此參數
# 默認設置為100ms
#jmeter.reportgenerator.graph.responseTimeDistribution.property.set_granularity=100
(六)第10段——指示為圖形和統計生成保留哪些樣本
(1)原文
# Change this parameter if you want to keep only some samples.
# Regular Expression which Indicates which samples to keep for graphs and statistics generation. # Empty value means no filtering #jmeter.reportgenerator.sample_filter=
(2)譯文
# 如果僅希望保留一些示例,請更改此參數。
# 正則表達式,它指示為圖形和統計生成保留哪些樣本。
# 空值意味着沒有過濾
#jmeter.reportgenerator.sample_filter=
(七)第11段——修改APDEX滿意度閾值
(1)原文
# Change this parameter if you want to override the APDEX satisfaction threshold.
#jmeter.reportgenerator.apdex_satisfied_threshold=500
(2)譯文
# 如果要修改APDEX滿意度閾值,請更改此參數。
#jmeter.reportgenerator.apdex_satisfied_threshold=500
(八)第12段——修改APDEX容忍閾值
(1)原文
# Change this parameter if you want to override the APDEX tolerance threshold.
#jmeter.reportgenerator.apdex_tolerated_threshold=1500
(2)譯文
# 如果要修改APDEX容忍閾值,請更改此參數。
#jmeter.reportgenerator.apdex_tolerated_threshold=1500
(九)第13段—— 指示篩選的圖形系列(正則表達式)
(1)原文
# Indicates which graph series are filtered (regular expression)
# In the below example we filter on Search and Order samples
# Note that the end of the pattern should always include (-success|-failure)?$ # TransactionsPerSecondGraphConsumer suffixes transactions with "-success" or "-failure" depending # on the result #jmeter.reportgenerator.exporter.html.series_filter=^(Search|Order)(-success|-failure)?$
(2)譯文
# 指示篩選的圖形系列(正則表達式)
# 在下面的示例中,在下面的示例中,我們對搜索和訂單樣本進行過濾(您只能修改搜索|訂單字段值,保留其余部分,以便在您不想要所有內容時僅保留報表中所需的事務)。 # 注意,模式的結尾應該始終包括 (-success|-failure)?$ # Transactions每秒后綴使用“-success”或“-failure”的事務,取決於 # 結果的 #jmeter.reportgenerator.exporter.html.series_filter=^(搜索|訂單)(-success|-failure)?$
(十)第14段——指示是否僅在支持該控制器的圖形上顯示控制器示例
(1)原文
# Indicates whether only controller samples are displayed on graphs that support it.
#jmeter.reportgenerator.exporter.html.show_controllers_only=false
(2)譯文
# 指示是否僅在支持該控制器的圖形上顯示控制器示例。
#jmeter.reportgenerator.exporter.html.show_controllers_only=false
(十一)第15段——選擇默認情況下將導出哪些事務
(1)原文
# This property is used by menu item "Export transactions for report"
# It is used to select which transactions by default will be exported #jmeter.reportgenerator.exported_transactions_pattern=[a-zA-Z0-9_\\-{}\\$\\.]*[-_][0-9]*
(2)譯文
# 此屬性用於菜單項“導出事務報告”
# 它用於選擇默認情況下將導出哪些事務
#jmeter.reportgenerator.exported_transactions_pattern=[a-zA-Z0-9_\\-{}\\$\\.]*[-_][0-9]*
(十二)第16段——自定義圖形定義
(1)原文
## Custom graph definition
#jmeter.reportgenerator.graph.custom_mm_hit.classname=org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumer #jmeter.reportgenerator.graph.custom_mm_hit.title=Graph Title #jmeter.reportgenerator.graph.custom_mm_hit.property.set_Y_Axis=Response Time (ms) #jmeter.reportgenerator.graph.custom_mm_hit.property.set_X_Axis=Over Time #jmeter.reportgenerator.graph.custom_mm_hit.property.set_granularity=${jmeter.reportgenerator.overall_granularity} #jmeter.reportgenerator.graph.custom_mm_hit.property.setSampleVariableName=VarName #jmeter.reportgenerator.graph.custom_mm_hit.property.setContentMessage=Message for graph point label
(2)譯文
## 自定義圖形定義
#jmeter.reportgenerator.graph.custom_mm_hit.classname=org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumer #jmeter.reportgenerator.graph.custom_mm_hit.title=Graph Title #jmeter.reportgenerator.graph.custom_mm_hit.property.set_Y_Axis=Response Time (ms) #jmeter.reportgenerator.graph.custom_mm_hit.property.set_X_Axis=Over Time #jmeter.reportgenerator.graph.custom_mm_hit.property.set_granularity=${jmeter.reportgenerator.overall_granularity} #jmeter.reportgenerator.graph.custom_mm_hit.property.setSampleVariableName=VarName #jmeter.reportgenerator.graph.custom_mm_hit.property.setContentMessage=Message for graph point label
3.4分布式測試配置
第17段——分布式測試配置
(1)原文
########################################################################
################## DISTRIBUTED TESTING CONFIGURATION ##################
########################################################################
# Type of keystore : JKS
#
#server.rmi.ssl.keystore.type=JKS # # Keystore file that contains private key # #server.rmi.ssl.keystore.file=rmi_keystore.jks # # Password of Keystore # #server.rmi.ssl.keystore.password=changeit # # Key alias # #server.rmi.ssl.keystore.alias=rmi # # Type of truststore : JKS # #server.rmi.ssl.truststore.type=JKS # # Keystore file that contains certificate # #server.rmi.ssl.truststore.file=rmi_keystore.jks # # Password of Trust store # #server.rmi.ssl.truststore.password=changeit # # Set this if you don't want to use SSL for RMI # #server.rmi.ssl.disable=false
(2)譯文
########################################################################
################## 分布式測試配置 ##################
########################################################################
# 密鑰庫類型:JKS
#
#server.rmi.ssl.keystore.type=JKS # # 包含私鑰的密鑰文件 # #server.rmi.ssl.keystore.file=rmi_keystore.jks # # 鍵盤密碼 # #server.rmi.ssl.keystore.password=changeit # # 密鑰別名 # #server.rmi.ssl.keystore.alias=rmi # # 信任庫類型:JKS # #server.rmi.ssl.truststore.type=JKS # # 包含證書的密鑰文件 # #server.rmi.ssl.truststore.file=rmi_keystore.jks # # 信任存儲區密碼 # #server.rmi.ssl.truststore.password=changeit # # 如果不想為RMI使用SSL,請設置此設置 # #server.rmi.ssl.disable=false
4.小結
上一篇中我們講解修改jmeter.properties文件官方建議:將需要修改的屬性值,復制粘貼到同目錄下的 user.properties,為什么本來在jmeter.properties修改的屬性值,復制到user.properties文件中仍然可以起作用了,原因如下圖所示:
從上圖中我們可以看出,Jmeter啟動讀取jmeter.properties文件的時候也會自動加載user.properties文件。所以在jmeter.properties修改的屬性值,復制到user.properties文件中仍然可以起作用。
好了,今天就分析和講解到這里吧!謝謝您耐心的閱讀!!!