jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Use parameter in parameter
Date Tue, 25 Sep 2007 12:33:41 GMT
Except of course by using BeanShell:

Create a file "evaluate.bshrc" containing:

//-------- cut here ---------
import org.apache.jmeter.engine.util.CompoundVariable;
String evaluate(String s){
CompoundVariable cv = new CompoundVariable();
cv.setParameters(s);
return cv.execute();
}
String evaluateVar(String v){
return evaluate(vars.get(v));
}
//--------- cut here --------

Define the property:

beanshell.function.init=evaluate.bshrc

so that the methods are made known to the BeanShell function.

You can then use the function call:

${__BeanShell(evaluate("string"))}

where string = ${query} - for example.

or

 ${__BeanShell(evaluateVar("query"))}

where query is the name of the variable.

to evaluate the contents of the variable "query".

In both cases, the parameter to the method must be a Java string, which is
why the quotes are needed.

The second example works even if the query variable contains double-quotes.

I'll see about adding an evaluate() function to the next release of JMeter.

On 25/09/2007, sebb <sebbaz@gmail.com> wrote:

> Sorry, you're right.
>
> __V() expects a variable name, not an arbitrary string containing variable
> references.
>
> I don't think that there's an easy way to do this currently.
>
> On 25/09/2007, Ori Marco <orim@praxell.com> wrote:
> >
> > Hi,
> >
> > Still I can't use parameter,because:
> > When tried to send ${__V(${query})} execute ${${query})}
> > When tried to send __V(${query}) execute __V(select * from test where
> > card=${card})
> >
> > It seems that __V support only full parameter name and not string with
> > parameters.
> >
> > Thanks
> >
> > Ori Marko
> > Quality Assurance Engineer
> > Praxell Inc.
> > Mobile: 0524-455-177
> > Office:03-6126060 Ext 612
> > Fax: 03-6126066
> > http://www.praxell.com
> >
> > -----Original Message-----
> > From: sebb [mailto: sebbaz@gmail.com]
> > Sent: Tuesday, September 25, 2007 12:04 PM
> > To: JMeter Users List
> > Subject: Re: Use parameter in parameter
> >
> > On 25/09/2007, Ori Marco <orim@praxell.com > wrote:
> >
> > > Hi
> > >
> > > I'm sorry , but I still have a problem, For modularity I need to put
> > > all selects (for example) in same file with parameters as card and
> > > user E.g in file : select * from test where card=${card} And to use
> > > this select in my jmx where card/user parameter is taken from another
> > > file (csv/user parameters)
> >
> >
> > It would have been helpful if you had explained this initially ;-)
> >
> >
> >
> > > How can this be accomplish?
> >
> >
> > See:
> >
> > http://jakarta.apache.org/jmeter/usermanual/functions.html#__V
> >
> > Instead of using
> >
> > ${query}
> >
> > on the JDBC sampler,
> >
> > try using
> >
> > ${__V(${query})}
> >
> >
> > > Thanks
> > >
> > > Ori Marko
> > > Quality Assurance Engineer
> > > Praxell Inc.
> > >
> > > -----Original Message-----
> > > From: sebb [mailto: sebbaz@gmail.com]
> > > Sent: Wednesday, August 29, 2007 11:34 PM
> > > To: JMeter Users List
> > > Subject: Re: Use parameter in parameter
> > >
> > > JMX files can include variable references (and definitions, e.g. UDV
> > > or User Parameters).
> > >
> > > Variables can be defined in files and read using
> > >
> > > http://jakarta.apache.org/jmeter/usermanual/component_reference.html#C
> >
> > > SV
> > > _Data_Set_Config
> > >
> > >
> > > Please also read the JMeter FAQ
> > >
> > > http://wiki.apache.org/jakarta-jmeter/JMeterFAQ
> > >
> > > particularly:
> > >
> > > http://wiki.apache.org/jakarta-jmeter/JMeterFAQ#head-87f846dad28fd6b2a
> > > d5
> > > eb0d44d527d572f810653
> > >
> > > http://wiki.apache.org/jakarta-jmeter/JMeterFAQ#head-81e8fdc6d08e5b574
> > > a0
> > > 6556f597f788df8ed12fe
> > >
> > > On 29/08/2007, Ori Marco <orim@praxell.com> wrote:
> > > > Hi
> > > >
> > > > I can't get parameters from included jmx file.
> > > > Isn't there another way or how can I get the parameters from another
> >
> >
> > > > jmx file?
> > > >
> > > > Thanks
> > > >
> > > > Ori Marko
> > > >
> > > > Quality Assurance Engineer
> > > >
> > > > Praxell Inc.
> > > >
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Ronan Klyne [mailto:ronan.klyne@groupbc.com]
> > > > Sent: Wednesday, August 29, 2007 2:28 PM
> > > > To: JMeter Users List
> > > > Subject: Re: Use parameter in parameter
> > > >
> > > > Ori Marco wrote:
> > > > > Hi
> > > > >
> > > > > For modularity I need to put all parameters in same source and not
> >
> > > > > per
> > > >
> > > > > jmx file.
> > > > > E.g. for reusing random parameter as
> > > > > random=${__Random(1,5000000,n)}
> > >
> > > > > in all jmx files.
> > > > > I need to get parameters from other source than inside jmx file (
> > > > > instead of adding component per jmx - to use 1 variable)
> > > > >
> > > >
> > > > Look up the Include Controller
> > > > (http://jakarta.apache.org/jmeter/usermanual/component_reference.htm
> > > > l#
> > > > In
> > > > clude_Controller)
> > > > - I think this will do what you need (although I've not done it
> > > > myself)...
> > > >
> > > >        # r
> > > >
> > > > --
> > > > Ronan Klyne
> > > > Business Collaborator Developer
> > > > Tel: +44 (0)870 163 2555
> > > > ronan.klyne@groupbc.com
> > > > www.groupbc.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
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message