You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by sebb <se...@gmail.com> on 2006/08/01 12:06:40 UTC

Re: using regex with beanshell

On 31/07/06, Yanroy <rm...@wpi.edu> 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: http://www.nabble.com/using-regex-with-beanshell-tf2029950.html#a5583703
> Sent from the JMeter - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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