Dynamic value to JMS PTP fields in Jmeter - jmeter

I have been trying for weeks now to find a way to handle jmeter script using only single thread group & pass connection variables dynamically by CSV file in which I'm failing terribly. I have multiple value in place of QueueConnection few test cases have message properties as well. I would like to find a way to eternalize is & use single thread group to achieve it.
Check the screenshot an example of variable which should take value dynamically from a file is what I'm expecting.
enter image description here

I don't think you will be able to use CSV file, you will have to go for JMeter Properties instead.
And in the JMS P2P Sampler you need to use __P() function to read the properties values
Something like:
The properties along with their respective values can be:
put into user.properties file like:
queueConnectionFactory=ConnectionFactory
passed via -J command-line arguments like
jmeter -JqueueConnectionFactory=ConnectionFactory
put into a separate .properties file, in this case you will need to "feed" this file to JMeter via -q command-line argument like:
jmeter -q /path/to/your/custom/JMS.properties -t test.jmx ...
More information:
Configuring JMeter
Apache JMeter Properties Customization Guide
Full list of command-line options

Related

overwriting parameters in Azure Load Testing

When the parameters are passed via the 'CSV Data Set Config' in the jmeter script, do we have a way of over-writing the values in Azure Load Testing tool,
I have away of externalising the parameters in Jmeter as well, in azure load testing, but when I combine both the values are not over-written
I don't think you can overwrite the JMeter Variable. You can overwrite the value of a JMeter Property so if you use __P() function to define some value in the test you can use user.properties file to give the property its respective value.
At the same time it would be possible to override the default property value via -J command-line argument.
More information:
Configuring JMeter
Overriding Properties Via The Command Line
Apache JMeter Properties Customization Guide
If you have parameterization implemented via CSV files the only way of amending the values is changing the CSV file itself, in that case you can take a look at awk language and/or sed editor.

How to pass properties files to Jmeter server in distributed setup

I have Jmeter distributed setup (One client and one server).
In single jmeter instance I'm using the below command to execute jmeter with a properties file that will pass the user defined variables to my test script
/apache-jmeter-5.3/bin/jmeter -p reco.properties -n -t Performance.jmx -l test2server.csv
When I tried to use the same command including the server configurations I noticed that the values defined in my "reco.properties" are not picked at the test execution.
Instead I need to pass all the variables with "-G" argument. Ex:
/apache-jmeter-5.3/bin/jmeter -GENV=test -n -t Performance.jmx -l test2server.csv
is it possible that I can pass all variables in a properties file for Jmeter Server as I do in the normal execution with "-p"?
Thank you
As per JMeter Documentation:
If the test uses any data files, note that these are not sent across by the client so make sure that these are available in the appropriate directory on each server. If necessary you can define different values for properties by editing the user.properties or system.properties files on each server.
So currently as per JMeter 5.4 this is not supported, you either need to pass the properties one-by-one like -Gprop1=value1 -Gprop2=value2 or to copy the .properties file to all the slave machines
The limitation can be also worked around via getting the properties from a dataabse using JDBC Request sampler or with plugins like HTTP Simple Table Server or Redis Data Set
If you do believe that the feature is essential you can try raising an enhancement request in JMeter Bugzilla

Is there any way to define testdata specific to the environments

Besides using the CSV config file and beanshell programming, is there any way to define the testdata specific to the environments?
Each environment varies different testdata(values) using same jmx script.
For example :Firstname,LastName,ProjectName so on..
You can have different properties in different environment.
You can have different or additional properties file
-p, --propfile
the jmeter property file to use
-q, --addprop
additional JMeter property file(s)
or override each property per environment using command line
-J[prop_name]=[value]
defines a local JMeter property.
The fastest and the easiest way is using JMeter Properties like:
In .jmx script define Firstname using __P() function like
${__P(Firstname)}
When you start JMeter pass this Firstname property value via -J command-line argument like:
jmeter -JFirstname=John
See Configuring JMeter User Manual chapter for more details.

I'm getting empty results attached in SMTP sampler

JMeter results I'm getting through different listener's,I want the results to come in mail
I tried it through smtp sampler
But, I'm getting mails without the results
I do not see any sign of attaching a file to the email in your SMTP Sampler, you should add the .jtl results file as attachment:
You may also need to amend one JMeter Property as by default JMeter doesn't store results as soon as samplers are finished, it flushes them to file in chunks
# AutoFlush on each line written in XML or CSV output
# Setting this to true will result in less test results data loss in case of Crash
# but with impact on performances, particularly for intensive tests (low or no pauses)
# Since JMeter 2.10, this is false by default
#jmeter.save.saveservice.autoflush=false
So add the next line to user.properties file:
jmeter.save.saveservice.autoflush=true
and restart JMeter to pick the property up. Or alternatively you can set the property via -J command-line argument like:
jmeter -Jmeter.save.saveservice.autoflush=true -n -t test.jmx -l result.jtl
See Configuring JMeter and Apache JMeter Properties Customization Guide for more information on tuning JMeter using properties.

Jmeter setup specific parameters on different host

My test plan use a parameter as startIndex.
In local case:
"thread pool 1" -> "Java Request" -> "Send Parameters With the Request" -> Add a parameter named startIndex,
and Create a config element - "User Defined variables", and give a parameter startIndex.
But how to give different startIndex parameters to each server,
for example:
serverA:"startIndex"=100, serverB:"startIndex"=200.
On each JMeter slave machine locate user.properties file under /bin folder of your JMeter installation
Add the following lines to this file:
on server 1: startIndex=100
on server 2: startIndex=200
Refer startIndex property value via __P() function as ${__P(startIndex,)} where required
Make sure you restart JMeter after user.properties file modification.
See Apache JMeter Properties Customization Guide for extended information on JMeter properties and ways of working with them
It is not a best practice to have create two variables having same names. If this situation is unavoidable then do not use 'user defined variables. Instead you can create the second variable under specific sampler, by using beanshell (vars.put) to create second variable. Not a tested technique but you can try.

Resources