I want to select books which is 'In-stock'. Each time number of 'In-stock' vary dynamically. Some time we have only 4 books "In-stock". some other time more or less than 4 books 'In-stock'.
1 Answer
It is not possible to provide the comprehensive answer without seeing the source of your "in stock" books so consider updating your question and provide enough information so we could reproduce your issue and come up with the solution.
In the meantime:
- Be aware that since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for any form of scripting so going forward consider using JSR223 PreProcessor
If you want to pass a value from JSR223 Test Elements to other JMeter components - the easiest way is writing the value into JMeter Variables using
vars
shortcut (stands for JMeterVariables class instance). For example the next line:vars.put('instock', org.apache.commons.lang3.RandomUtils.nextIn+t(2,11) as String)
will put a random number between 2 and 10 inclusively into
instock
JMeter Variable which you can reference as${instock}
where required. Check out Top 8 JMeter Java Classes You Should Be Using with Groovy article for more information on JMeter API shorthands available for JSR223 Test Elements