[英]Jmeter: Not reading the property from the property location given from command line
File: DevEnv.properties 文件:DevEnv.properties
# Development Environment property file
environment.protocol=https
environment.hostname=dev.env.com
environment.port=443
environment.path=api
File: StagingEnv.properties 文件:StagingEnv.properties
# Staging Environment property file
environment.protocol=https
environment.hostname=staging.env.com
environment.port=443
environment.path=stagingapi
command used jmeter -g "StagingEnv.properties" - t "Practice11.jmx" ; 使用的命令jmeter -g“ StagingEnv.properties”-t“ Practice11.jmx” ;
Test Plan Structure 测试计划结构
Test Plan
JSR223 PreProcessor
HTTP Request Defaults
Thread Group
jp@gc - Dummy Sampler
View Results Tree
In short value should read from file location provided in command line and when run directly then it must be read the default value. 简而言之,应该从命令行中提供的文件位置读取值,并且直接运行时必须读取默认值。
You can try defining the ${__P(variable,defaultVariable)}
in User Defined Variables
itself and use it with default values or command line arguments. 您可以尝试在
User Defined Variables
本身中定义${__P(variable,defaultVariable)}
,并将其与默认值或命令行参数一起使用。 no need for reading it from properties file. 无需从属性文件中读取它。
protocol ${__P(protocol,https)}
hostname ${__P(hostname,testHostName.com)}
port ${__P(port,80)}
Then command to use it: 然后命令使用它:
jmeter -Dprotocol='http' -Dhost='localhost' -n - t "Practice11.jmx";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.