0
votes

I have wrote a script in BeanShell Sampler, which call for a java thread through script, while start the script in jmeter consol its keep on running, so I am not comeout from BeanShell Sampler and unable to proceed to next step in jmeter

Someone please help me, how to comeout from BeanShell Sampler after running the script

Regards Ranjan

1

1 Answers

0
votes

In Beanshell Sampler you have a number of pre-defined variables, like:

  • vars
  • props
  • ctx
  • log

The one you need is SampleResult which is an instance of org.apache.jmeter.samplers.SampleResult

The methods you may find useful are:

  1. setStopThread - the most lenient one, probably the one you're looking for
  2. setStopTest - will stop entire test (will tell all samples to stop)
  3. setStopTestNow - force stop entire test, doesn't wait for samples to gracefully shutdown, you may receive unexpected errors if decide to use this option so be careful

So I guess that you need to place next code line at the bottom of your Beanshell Sampler:

SampleResult.setStopThread(true);