1. Introdução
Por que o irmão Hong quer explicar o arquivo de configuração do Jmeter? É porque algumas crianças ou amigos encontraram alguns problemas que exigem a modificação do arquivo de configuração durante o teste. Eles não são muito claros ou entendem. Mesmo que sejam modificados, ainda é vago. Além do mais, algumas pessoas pensam que é um lugar sagrado e não pode ser violado levianamente. Eles não ousam tocá-lo e não o modificam. Eles temem que, se o modificarem incorretamente, o Jmeter não consiga funcionar. Depois de ouvir a ousada modificação do irmão Hong, você não precisará reinstalar um novo Jmeter. Ou se você tiver o bom hábito de fazer backups, faça modificações ousadas após fazer o backup antes da modificação. Se você cometer um erro, pode simplesmente usar o backup arquivo para restaurá-lo.
2. Arquivo de configuração
Insira: propriedades na caixa de pesquisa no diretório %JMETER_HOME%\bin (ou $JMETER_HOME/bin) e você descobrirá que existem vários arquivos de configuração, conforme mostrado na figura a seguir:
Se você quiser aprender testes automatizados, recomendo um conjunto de vídeos para você. Este vídeo pode ser considerado o tutorial de teste automatizado número um em toda a rede reproduzida por Bilibili. O número de pessoas online ao mesmo tempo atingiu 1.000 , e também há notas que podem ser coletadas e comunicadas por diversos canais.Mestre comunicação técnica: 798478386
A seguir, iremos explicá-los e explicá-los um por um em ordem de importância. O mais importante é jmeter.properties. É o arquivo de item de configuração principal do Jmeter. As configurações de alguns de seus itens de configuração comumente usados são resumidas e explicadas abaixo.
2.Recomendações oficiais
Copie e cole os valores das propriedades que precisam ser modificadas em user.properties no mesmo diretório. Aqui está uma breve menção. O arquivo user.properties será apresentado posteriormente.
Benefício: Quando o Jmeter é atualizado, as modificações podem ser evitadas e não precisam ser reaplicadas
Arquivo 3.jmeter.properties
Como este arquivo é muito grande, o irmão Hong traduziu parte dele aqui. Se você estiver interessado, pode ler tudo para ver o que faz.
3.1 Descrição da licença do arquivo
3.1.1 Parágrafo 1º – Descrição da Licença
(1) Texto original
################################################################################
# Apache JMeter Property 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 Instruções de modificação de arquivo
3.2.1 Parágrafo 2 - usado para descrever o arquivo jmeter.properties
(1) Texto original
################################################################################
#
# THIS FILE SHOULD NOT BE MODIFIED
#
# This avoids having to re-apply the modifications when upgrading JMeter
# Instead only user.properties should be modified:
# 1/ copy the property you want to modify to user.properties from jmeter.properties
# 2/ Change its value there
#
################################################################################
# JMeter properties are described in the file
# http://jmeter.apache.org/usermanual/properties_reference.html
# A local copy can be found in
# printable_docs/usermanual/properties_reference.html
#Preferred GUI language. Comment out to use the JVM default locale's language.
#language=en
# Additional locale(s) to add to the displayed list.
# The current default list is: en, fr, de, no, es, tr, ja, zh_CN, zh_TW, pl, pt_BR
# [see JMeterMenuBar#makeLanguageMenu()]
# The entries are a comma-separated list of language names
#locales.add=zu
(2) Tradução
################################################################################
#
# 这个文件不应该被修改
#
# JMeter这就避免了在升级JMeter时必须重新应用配置而再次修改
# user.properties文件的修改代替这里文件的修改:
# 1/ 从jmeter.properties文件中复制要修改的属性到user.properties文件中修改
# 2/ 在user.properties文件中修改复制属性的值
#
################################################################################
# 这个文件中描述了JMeter的配置
# 文件访问地址:http://jmeter.apache.org/usermanual/properties_reference.html
# 这个文件的副本在本地也可以找到
# 本地文件的位置:printable_docs/usermanual/properties_reference.html
#首选GUI语言。注释掉以使用JVM默认语言环境的语言。
#language=en
# 要添加到显示列表的其他区域设置。
# 当前默认的列表: en, fr, de, no, es, tr, ja, zh_CN, zh_TW, pl, pt_BR
# [请参见JMeterMenuBar\35; MakeLanguageenu()]
# 这些条目是以逗号分隔的语言名称列表
#locales.add=zu
3.3 Descrição do analisador XML
3.3.1 Parágrafo 3 – usado para descrever analisadores XML
(1) Texto original
#---------------------------------------------------------------------------
# XML Parser
#---------------------------------------------------------------------------
# Path to a Properties file containing Namespace mapping in the form
# prefix=Namespace
# Example:
# ns=http://biz.aol.com/schema/2006-12-18
#xpath.namespace.config=
# XPath2 query cache for storing compiled XPath queries
#xpath2query.parser.cache.size=400
(2) Tradução
#---------------------------------------------------------------------------
# XML 解析器
#---------------------------------------------------------------------------
# 包含格式为prefix = Namespace的名称空间映射的属性文件的路径。例子:
# prefix=Namespace
# Example:
# ns=http://biz.aol.com/schema/2006-12-18
#xpath.namespace.config=
# 查询缓存,用于存储编译的XPath查询,默认为400
#xpath2query.parser.cache.size=400
3.4 Descrição da configuração SSL
3.4.1 Parágrafo 4 - usado para descrever a configuração SSL
(1) Texto original
#---------------------------------------------------------------------------
# SSL configuration
#---------------------------------------------------------------------------
## SSL System properties are now in system.properties
# JMeter no longer converts javax.xxx property entries in this file into System properties.
# These must now be defined in the system.properties file or on the command-line.
# The system.properties file gives more flexibility.
# By default, SSL session contexts are now created per-thread, rather than being shared.
# The original behaviour can be enabled by setting the JMeter property to true
#https.sessioncontext.shared=false
# Be aware that https default protocol may vary depending on the version of JVM
# See https://blogs.oracle.com/java-platform-group/entry/diagnosing_tls_ssl_and_https
# See https://bz.apache.org/bugzilla/show_bug.cgi?id=58236
# Default HTTPS protocol level:
#https.default.protocol=TLS
# This may need to be changed here (or in user.properties) to:
#https.default.protocol=SSLv3
# List of protocols to enable. You may have to select only a subset if you find issues with target server.
# This is needed when server does not support Socket version negotiation, this can lead to:
# javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
# java.net.SocketException: Connection reset
# see https://bz.apache.org/bugzilla/show_bug.cgi?id=54759
#https.socket.protocols=SSLv2Hello SSLv3 TLSv1
# Control if we allow reuse of cached SSL context between iterations
# set the value to 'false' to reset the SSL context each iteration
# Deprecated since 5.0
#https.use.cached.ssl.context=true
#
# Reset HTTP State when starting a new Thread Group iteration which means:
# true means next iteration is associated to a new user
# false means next iteration is associated to same user
# true involves:
# - Closing opened connection
# - resetting SSL State
#httpclient.reset_state_on_thread_group_iteration=true
# Start and end index to be used with keystores with many entries
# The default is to use entry 0, i.e. the first
#https.keyStoreStartIndex=0
#https.keyStoreEndIndex=0
(2) Tradução
#---------------------------------------------------------------------------
# SSL 配置
#---------------------------------------------------------------------------
## SSL系统属性现在位于system.properties中
# JMeter不再转换javax。jmeter.properties中的xxx属性条目 进入系统属性
# 现在必须在system.properties文件或命令行中定义它们。
# 在 system.properties文件提供了更多的灵活性。
# By default, SSL session contexts are now created per-thread, rather than being shared.默认情况下,SSL会话上下文现在是按线程创建的,而不是共享的。
# 可以通过将此属性设置为true来启用原来行为。默认为:false
#https.sessioncontext.shared=false
# 请注意,https默认协议可能会根据JVM的版本而有所不同。
# See https://blogs.oracle.com/java-platform-group/entry/diagnosing_tls_ssl_and_https
# See https://bz.apache.org/bugzilla/show_bug.cgi?id=58236
# 默认HTTPS协议级别:
#https.default.protocol=TLS
# 这可能需要(或者在user.properties文件中) 更改为:
#https.default.protocol=SSLv3
# 要启用的协议列表。如果发现目标服务器有问题,则可能只需要选择一个子集。
# 如果服务器不支持Socket版本协商,则需要这样做,这可能导致以下错误:
# javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
# java.net.SocketException: Connection reset
# see https://bz.apache.org/bugzilla/show_bug.cgi?id=54759
#https.socket.protocols=SSLv2Hello SSLv3 TLSv1
# 控制是否允许在迭代之间重用缓存的SSL上下文。
# 将值设置为false可在每次迭代时重置SSL上下文。默认为:true
# Deprecated since 5.0
#https.use.cached.ssl.context=true
#
# 开始新的线程组迭代时,重置HTTP状态。
# true表示下一次迭代与新用户相关联。
# false表示下一次迭代与同一用户相关联。
# true 涉及:
# - 关闭打开的连接
# - 重置SSL状态
#httpclient.reset_state_on_thread_group_iteration=true
# 与具有许多条目的密钥库一起使用的起始索引和结束索引。
# 默认值是使用条目0,即第一个。
#https.keyStoreStartIndex=0
#https.keyStoreEndIndex=0
Abaixo selecionarei alguns mais usados e importantes para compartilhar com calçados infantis ou amigos.
4. Linguagem GUI
4.1 Sistema Windows
4.1.1 Método 1
——Modifique Opções
e clique em Opções-->Escolher Idioma-->Chinês (Simplificado) para configurá-lo para Chinês Simplificado. Deve-se observar que este método só entra em vigor nesse momento. Na próxima vez que você abrir o Jmeter, ele ainda estar em inglês. Se você deseja que tenha efeito permanente, use os dois métodos a seguir.
4.1.2 Método 2
——Modifique o arquivo jmeter.properties
Abra o diretório bin no arquivo descompactado jmeter, encontre o arquivo jmeter.properties e abra-o com um editor.
Insira uma linha de idioma=zh_CN em #idioma=en e salve-a após a modificação. Reinicie
o Jmeter e a interface será exibida como simplificada Chinês.
Perceber:
功能:设置JMeter GUI界面的显示语言
说明:若没有设置,则使用JVM(Java虚拟机)设置的locale语言.
4.1.3 Método 3
——Modifique o arquivo jmeter.bat
Use um editor para abrir o arquivo de inicialização do JMeter jmeter.bat
e altere o conjunto JMETER_LANGUAGE=-Duser.language="en" -Duser.region="EN" para definir JMETER_LANGUAGE=-Duser.language="zh" -Duser.region= "CN", salve o código
e reinicie a interface Jmeter para exibir em chinês simplificado.
4.2Sistema Linux
No Linux, você pode definir o código do idioma da JVM:
[root@localhost ~]# locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
[root@localhost ~]# vi /etc/sysconfig/i18n
[root@localhost ~]# cat !$
cat /etc/sysconfig/i18n
LANG="zh_CN.UTF-8"
[root@localhost ~]#
注意:此配置项只能在jmeter.properties中设置才有效。
5.Configuração da taxa de ampliação do ícone GUI
Layout da interface GUI 5.1JMeter
Quando o JMeter está sendo executado no modo GUI, a janela é composta principalmente de três partes:
1. Faixa de opções:
barra de menu superior, barra de ferramentas inferior. A barra de menu exibe o menu de funções fornecido pelo JMeter e os ícones na barra de ferramentas
são atalhos para funções comuns.
2. A área de visualização
apresenta elementos JMeter em uma estrutura de árvore, onde "Test Plane" é o nó raiz da árvore e cada nó é um elemento JMeter.
Nesta área, os nós podem ser adicionados, excluídos ou a posição dos nós ajustada arrastando.
3. Área de conteúdo
Quando um nó de elemento JMeter é selecionado na área de visualização, a área de conteúdo exibirá o conteúdo do elemento de acordo.
Neste momento, você pode visualizar, definir e outras operações em seu conteúdo.
Configuração da taxa de ampliação do ícone 5.2GUI
jmeter.hidpi.mode=true #开启视网膜模式
jmeter.hidpi.scale.factor=1.2 #将图标放大1.2倍
5.3 Configuração do tamanho do ícone da barra de ferramentas da faixa de opções
#工具栏图标默认size: 22x22
#可用size: 22x22, 32x32, 48x48
jmeter.toolbar.icons.size=32x32
5.4 Configurando o tamanho do ícone da árvore de diretórios na área de visualização
#目录树图标默认size: 19x19
#可用size: 19x19, 24x24, 32x32, 48x48
jmeter.tree.icons.size=24x24
5.5 Editar configurações de fonte na área de conteúdo
#调整JMeter内容区的编辑字体
jsyntaxtextarea.font.family=consolas #默认Hack,太难看,使用经典的consolas
jsyntaxtextarea.font.size=18 #这两个配置项必须同时设置才有效
5.6 Configurações de codificação de dados de resposta
#响应数据编码默认为ISO-8859-1(即Latin-1)
sampleresult.default.encoding=UTF-8 #设置为UTF-8,避免出现乱码
6. Adicionar configurações de tecla de atalho do elemento JMeter
#配置添加JMeter元素时使用的快捷键,最多支持10个.
#在windows上可以使用 Ctrl+0 Ctrl+1 ... Ctrl+9
#在macOS上可以使用 Command+0 Command+1 ... Command+9
gui.quick_0=ThreadGroupGui #新增线程组
gui.quick_1=HttpTestSampleGui #新增HTTP取样器
gui.quick_2=RegexExtractorGui #新增正则表达式提取器
gui.quick_3=AssertionGui #新增响应断言
gui.quick_4=ConstantTimerGui #新增常量定时器
gui.quick_5=TestActionGui #新增测试活动
gui.quick_6=JSR223PostProcessor #新增JSR223 后置处理程序
gui.quick_7=JSR223PreProcessor #新增JSR223 预处理程序
gui.quick_8=DebugSampler #新增调试取样器
gui.quick_9=ViewResultsFullVisualizer #新增察看结果树
7.Configuração do tipo de conteúdo de postagem de solicitação HTTP
# Should JMeter add to POST request content-type header if missing:
# Content-Type: application/x-www-form-urlencoded
# Was true before version 5.0
post_add_content_type_if_missing=true
说明:此配置项在JMeter5.0以前默认值为true,以后版本默认为false,故在5.0以后的版本中
发送POST请求,将参数放在"body data"中,且没有设置
Content-Type时,默认为Content-Type值为"text/plain",而不是"application/x-www-form-urlencoded".
8. Resumo
1. Ao definir o idioma da GUI, descobri que as configurações no arquivo jmeter.properties de Hongge foram comentadas e Hongge usou o idioma local padrão do win10. O idioma local padrão era o chinês. No entanto, depois que Hongge iniciou o jmeter, ele descobriu que o idioma da GUI ainda era o inglês. Após uma série de pesquisas, descobriu-se que era porque havia configurações de idioma no arquivo jmeter.bat.
Use um editor para abrir o arquivo de inicialização do JMeter jmeter.bat
e altere o conjunto JMETER_LANGUAGE=-Duser.language="en" -Duser.region="EN" para definir JMETER_LANGUAGE=-Duser.language="zh" -Duser.region= "CN", salve o código
e reinicie a interface Jmeter para exibir em chinês simplificado.
2. Todos os idiomas em jvm obtêm o idioma de localidade do sistema
(1) Sistema Windows
a. Digite o comando: java -X
b. Insira o comando: java -XshowSettings:locale
(2)Sistema Linux
a. Digite o comando: java -X
b. Insira o comando: java -XshowSettings:locale