0

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'.

0

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:

  1. 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
  2. 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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.