Practical issues and solutions for working with JMeter – Part1

Most of the time we are struck with very granular issues with JMeter. To overcome these type of hurdles we are sharing the pragmatic solutions to problems.

Refer part2 of learning for more issues

Do share your issues/solutions in the comment section below to help others as we always believe sharing is caring, and Life is short..share while you still have knowledge

How to pass random value in Json URI or Json parameters for API call using Jmeter?

Solution :- 
By using “Random Variable”
Where to find in JMeter
Add > Config Element > Random Variable

Name the variable as you want, put the range or create your own formula and start using this variable in Json URI or Json parameters

How to create RandomString?

Random variable in jmeter
Not to execute the second sampler if first sampler value fails in Jmeter?

Solution :- 
By using “if controller”
Where to find in JMeter
Add > Logic controller > if controller

In condition add ${JMeterThread.last_sample_ok} 
Note:- Above value is predefined variables in jmeter

if controller jmeter

How to execute python script(command script) in jmeter?

Solution :- 
By using “OS sampler”
Where to find in JMeter

Add > Sampler > Os sampler

Example:- Lets say we want to run our MQTT test generator code
We will replicate the command step in OS sampler, 
python3 10 10 1  and define the working directory(referring to the script path)

command script from jmeter

More scenarios

Leave a Reply

Your email address will not be published. Required fields are marked *