jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <>
Subject Re: using regex with beanshell
Date Tue, 01 Aug 2006 10:06:40 GMT
On 31/07/06, Yanroy <> wrote:
> Hi all,
> Upon the advice of the people on this list, I've started using beanshell to
> do the complex parts of my jmeter test.  So far, this seems like a really
> good idea.  I'd read that beanshell was a terrible language, but after a
> little experience with it, I think it's great (I suspect the person who
> didn't like it was objecting to the lax type mode and strange class
> declaration syntax).  Anyways, I need to make beanshell look at the results
> of an HTTP sample and perform conditional operations based on the data
> contained in it.  To that end, I need to know how to use a regex from inside
> beanshell.

Or use the exisiting RE to extract the information, and BeanShell to process it.

> Is there a way to use jmeter's regular expression extractor
> element (or at least functionality) from inside beanshell?  A google search
> has returned dismally little info on using beanshell with jmeter.

The RE is designed to put the results in variables; it is not designed
as a utility module so it would probably not offer any benefit to call
it from BeanShell.

You can use Java RE or Jakarta ORO directly from BeanShell, but I
suspect you would be better off using the JMeter RE Post-Processor in
conjunction with BeanShell.

> Also, I have another related question... does a beanshell assertion only
> apply to its parent sampler?  I ask this because I'd like to have 2 samplers
> that both share a single beanshell assertion.  I'm hoping the assertion
> actually responds to the most recent request rather than the parent in the
> tree.

Assertions are applied to all samples in their scope. The scope of a
child element is its (sole) parent.

> Thanks for all your help,
> Ryan (aka Yanroy)
> --
> View this message in context:
> Sent from the JMeter - User forum at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message