'JMeter - Create Custom Property File
I have a script with User Defined Variables
These are to be defined as a property in a custom property file (other than jmeter or user properties)
Also, in the groovy script (JSR223 Sampler) a file location needs to be parameterized into the same custom property file.
Please let me know if there is a way out. Thanks for your support.
Regards, Ajith
Solution 1:[1]
You can put the following lines to i.e. custom.properties
file:
Host=10.184.192.248
User=root
Pass=install
FileLocation=C:/Users/503289283/Downloads/Service_Names.csv
Then you can "tell" JMeter to read this property file via -q
command-line argument like:
jmeter -q /path/to/custom.properties -t /path/to/testplan.jmx .....
And finally you can use __P() function to read the properties values in the User Defined Variables:
${__P(host,)}
In the JSR223 Sampler you can use props
shorthand to retrieve FileLocation
property value like:
f = new File(props.get('FileLocation'))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dmitri T |