Marcin Erbel
Marcin Erbel

Reputation: 1643

BeanShell PreProcessor

I've a few BeanShellScripts inside my JMeter Project. I would like to use a few of them inside my project. I'm using command inside BeanShell PreProcessor to invoke another BeanShellProcessor in my project:

${__BeanShell(Name_Of_My_Script)}

But I realized that It's opening them a few times, so sometimes the request is sending with wrong value. Is there any another command or option to do this?

Upvotes: 0

Views: 1100

Answers (2)

Marcin Erbel
Marcin Erbel

Reputation: 1643

It's working quite well if you use Module Controller which indicate a current Simple Controller with Beanshell script to run. Inside Simple Controller should be BeanShell Sampler.

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168157

I don't think that it's a right way to execute Beanshell via function. As per JMeter Beanshell manual Beanshell Script attribute should be

A beanshell script (not a file name)

More correct way is storing your another Pre-Processor script code into a JMeter Variable, i.e. SCRIPT2 and call it as ${__BeanShell(${SCRIPT2})}.

You won't need to escape anything as the function automatically parses input script.

See How to use BeanShell guide for more details on Beanshell scripting.

Upvotes: 1

Related Questions