File: DevEnv.properties
# Development Environment property file
environment.protocol=https
environment.hostname=dev.env.com
environment.port=443
environment.path=api
File: 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";
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. 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";