0

I wrote a Script in Test Case inside BeanShell PreProcessor and I want to use the value(Integer) in ThreadGroup.

By using vars.put() we can only share String type of values.

NOTE: I want to use the value in Number of Threads(users) block

Image Link

Community
  • 1
  • 1
KCS
  • 442
  • 5
  • 20

1 Answers1

1

There are at least 3 ways of doing this:

  1. Use vars.putObject() - places an arbitrary Object into JMeterVariables
  2. Cast Integer to String vars.put("foo", String.valueOf(bar));
  3. Use bsh.shared namespace like:

    bsh.shared.myInt = 15
    

See How to Use BeanShell: JMeter's Favorite Built-in Component guide for more information on Beanshell scripting in JMeter tests

NOTE! you won't be able to amend number of threads in the current Thead Group using Beanshell test elements.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks for reply. But I just added an image link. Look into it and tell me. In Beanshell Preprocessor I got a value and I want to use the value (Of course Integer type) in *Number of Threads* block – KCS Oct 28 '16 at 08:49