0
votes

I have JSON Request where multiple products nodes returns from there I am using product SKU inside the for each controller as input and sku_value as output which I am using in subsequent request. Inside this for each controller I have another beanshell sampler where I would like print/display to use other values returns by first JSON request i tried this Jmeter counter function value to be displayed in Benashell Post Processor or sampler vars.get("productId_" + vars.get("counter")) but it return NULL if I use ${__V(productId_${__counter(TRUE,)})} at the sampler name it correctly prints the value but i want this value to printed using log.info please help.

1

1 Answers

0
votes

Double check that ${counter} variable exists and has valid numeric value using Debug Sampler and View Results Tree listener combination

If your ${__V(productId_${__counter(TRUE,)})} works fine you can just use it in Beanshell Sampler's "Parameters" section and refer the value as Parameters in the script:

enter image description here

Also be aware that starting from JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting so consider migrating to Groovy on next available opportunity.