-2

How to extract parameter in beanshell. Please give me some example or link. Thank you.

Jheng Ibasco
  • 1
  • 1
  • 2
  • 5

2 Answers2

0

I have only used the PostProcessor element 'JSON extractor' to extract a value from a response. There are other extractor elements in the PostProcessors. Once you extract the value into a variable, if you need it in another thread group, you can add it to a beanshell to make it a property, for example like this:

${__setProperty(clientId, ${clientId})};

Then when you need to use the clientId, you would just call it whereever you need like this:

${__property(clientId)}
joCha
  • 302
  • 1
  • 6
  • 23
0

First of all "usual" recommendation to use JMeter's built-in components where possible and avoid scripting unless it is absolutely required. If it is - consider using JSR223 Test Elements and Groovy language as other supported scripting languages have performance issues.

Coming back to your "question":

We are not telepathic enough to guess what you are trying to achieve. See How to Use BeanShell: JMeter's Favorite Built-in Component for general information on Beanshell scripting in JMeter tests and/or elaborate your question providing more details.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133