Practical issues and solutions for working with JMeter – Part1 – User friendly Tech help
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.
n
nRefer part2 of learning for more issues
n
nDo 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
n
nScenario:-
nHow to pass random value in Json URI or Json parameters for API call using Jmeter?
n
nSolution :-
nBy using “Random Variable”
nWhere to find in JMeter
nAdd > Config Element > Random Variable
n
nName the variable as you want, put the range or create your own formula and start using this variable in Json URI or Json parameters
n
n Scenario:-
nNot to execute the second sampler if first sampler value fails in Jmeter?
n
nSolution :-
nBy using “if controller”
nWhere to find in JMeter
nAdd > Logic controller > if controller
n
nIn condition add ${JMeterThread.last_sample_ok}
nNote:- Above value is predefined variables in jmeter
n
nn
nScenario:-
nHow to execute python script(command script) in jmeter?
n
nSolution :-
nBy using “OS sampler”
nWhere to find in JMeter
n
nAdd > Sampler > Os sampler
n
nExample:- Lets say we want to run our MQTT test generator code.
nWe will replicate the command step in OS sampler,
npython3 mqttgen.py 10 10 1 and define the working directory(referring to the script path)
n