Is there any way to define testdata specific to the environments - jmeter

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.

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.

Dynamic value to JMS PTP fields in 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

How to use Taurus to modify a jmeter script

I'm trying out taurus to run some existing jmeter scripts, setting various properties to local values.
I can use the -gui mode to load the modified script in the jmeter GUI and debug. However, I can't update this and replace the original file because Taurus has added two jtl data writers. I can suppress "Errors Writer" with e.g. -o execution.0.write-xml-jtl=none, but I can't see a way to suppress "KPI Writer". It's also possible further undesirable modifications have been made.
Is there a way to launch the GUI so that I can edit the original file, using the properties from the Taurus yaml file?
You cannot run the original jmeter scripts through bzt however it is possible to manipulate few properties of the newly generated jmx file through the yml file. Modified jmx is a copy of original script where two Listeners (errors and kpi) and variables from the yml.
It now depends on what exactly are you looking to change?

Setting up different number of users in JMeter master slave

In my JMeter master-slave setup, I want to setup a different number of users in each slave for the same thread group.Is it possible to setup with properties file? Is there any other way?
In Load Runner we can configure this easily with Load Generators. How to do in JMeter?
I would recommend doing it as follows:
In your Test Script define number of users using __P() function like ${__P(users,)}
In user.properties file on each slave machine specify the desired number of users like:
users=50
You can also pass the value via -J argument like:
jmeter -Jusers=100 ...
References:
How to do remote testing the 'proper way'?
Apache JMeter Properties Customization Guide

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