jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sonam Chauhan <sonam.chau...@ce.com.au>
Subject RE: Using BeanShell
Date Mon, 22 Nov 2004 07:26:03 GMT
Hello - 

> Now sure about browsing JMeter packages. The BSH documentation might
> give some clues.

I jerry-rigged the following script in a BeanShell sampler to get the
beanshell class browser running in JMeter:
------------------
import bsh.util.*;
junkArray = new String[0];
ClassBrowser.main(junkArray);
------------------

It's proving in handy in quickly browsing all packages and classes used by
JMeter. 

Here's a BeanShell script to stop the current thread: 
------------------
if (...) 
	//stops thread cold!
	org.apache.jmeter.threads.JMeterThread.stop();
------------------

Thanks to whoever put Beanshell in (I believe that's you Sebb - thank you!)

With regards,
Sonam Chauhan
-- 
Corporate Express Australia Ltd.
Phone: +61-2-9335-0725, Fax: 9335-0753, Email: sonamc@ce.com.au
 

> -----Original Message-----
> From: sebb [mailto:sebbaz@gmail.com]
> Sent: Friday, 19 November 2004 1:38 AM
> To: JMeter Users List
> Subject: Re: Using BeanShell
> 
> On Thu, 18 Nov 2004 18:35:57 +1100, Sonam Chauhan
> <sonam.chauhan@ce.com.au> wrote:
> > Thanks for the tips guys. I have BeanShell working and it's pretty
> neat...
> > and it's better than sliced bread!
> >
> > I used this tiny bsh script into a JMX:
> > -------------
> > a = JButton("click me")
> > Frame (a);
> > -------------
> > Then I ran the JMX in non-GUI mode.
> > Lo and behold - JMeter tests now pop up a _custom_ GUI. Wow!
> >
> > Two questions:
> >
> > 1. I see that the BeanShell sampler and BeanShell assertion can access
> > certain special variables (e.g.: 'ResponseCode'). Can the BeanShell
> > components access JMeter classes? (Something like the bsh "class
> browser",
> > but for JMeter classes.)
> 
> BSH can "import" any packages it wants - see some of the BSH scripts
> in extras and bin.
> 
> Now sure about browsing JMeter packages. The BSH documentation might
> give some clues.
> 
> >
> > 2. Can JMeter BeanShell samplers components access JMeter "${XXX}")
> > variables?
> 
> I'd assumed that any variables that were needed could be passed in as
> parameters to the script - or embedded in it, if using the script
> panel (rather than using a file name. JMeter variables embedded in
> files are not interpreted, as the file is passed directly to BSH).
> 
> However one could import the appropriate JMeter packages and define a
> shortcut method to access them.  See for example extras/startup.bsh.
> 
> If this was found to be generally useful, get and set methods could be
> provided by the classes that instantiate the interpreter, in much the
> same way that access to responseData etc is currently provided.
> 
> >
> > Please educate me if I am missing some obvious documentation somewhere
> that
> > answers all this.
> >
> 
> Well, there's the BSH documentation, some BSH scripts in bin and
> extras, and there's always the JMeter Wiki if you want to add some
> details to it!
> 
> > With regards,
> > Sonam Chauhan
> > --
> [...]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message