Hi
why not just an IF controller around the beanshell sampler?
${__threadNum()} == 1
If your beanshell is inline then you need to use ${__threadNum()}
If your beanshell is a function or a file , then there is a Jmeter object
that you use -
http://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterContext.htmlAgain the setUpThreadGroup was written for such usecases and is cleaner. regards deepak On Wed, Feb 1, 2012 at 1:43 PM, Nirodha Pramod <[email protected]> wrote: > On Wed, Feb 1, 2012 at 11:44 PM, Deepak Shetty <[email protected]> wrote: > > > Hi > > Only Once is per thread - if you want this once for the whole test then > you > > should probably be using the Setup ThreadGroup (or you can use an If > > controller which only executes its children for threadnumber 1) > > > > In that case how can I read the running thread number in side beanshell. I > found that there's a function called threadNum, but I could not find how to > call a function inside beanshell PP. > > Does it work if I give vars.get("_threadNum"); ?? > > > > > regards > > deepak > > > > On Wed, Feb 1, 2012 at 9:34 AM, Nirodha Pramod <[email protected]> wrote: > > > > > Hi, > > > > > > I was using a beanshell preprocessor and it was not working because > there > > > was no sampler for that. When I added a sampler it worked. But the > issue > > it > > > gets executed the number of times as the number of threads(1000 times > as > > my > > > thread count is 1000), and not only once. What is the issue with that? > > > > > > Thanks, > > > Nirodha > > > > > > On Wed, Feb 1, 2012 at 2:29 AM, Deepak Shetty <[email protected]> > wrote: > > > > > > > Beanshell sampler or preprocessor? > > > > If sampler then check the logs if there are errors. If pre/post > > processor > > > > then these need at least one sampler to run against > > > > > > > > regards > > > > deepak > > > > > > > > On Tue, Jan 31, 2012 at 12:47 PM, Nirodha Pramod <[email protected]> > > > wrote: > > > > > > > > > Hi, > > > > > > > > > > I have used a beanshell as a child of Once only controller. But it > > > > doesn't > > > > > seem to run the beanshell never. I have put a print statement just > to > > > > > debug, but it never gets printed. Is it a correct way to use the > once > > > in > > > > > controller. Can someone give a solution, please. > > > > > > > > > > Thanks, > > > > > Nirodha > > > > > > > > > > -- > > > > > *Nirodha Gallage* > > > > > Software Engineer, QA. > > > > > WSO2 Inc.: http://wso2.com/ > > > > > Email: [email protected] Mobile: +94716429078 > > > > > > > > > > > > > > > > > > > > > -- > > > *Nirodha Gallage* > > > Software Engineer, QA. > > > WSO2 Inc.: http://wso2.com/ > > > Email: [email protected] Mobile: +94716429078 > > > > > > > > > -- > *Nirodha Gallage* > Software Engineer, QA. > WSO2 Inc.: http://wso2.com/ > Email: [email protected] Mobile: +94716429078 >
