jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Speteanu <asp.ad...@gmail.com>
Subject Re: About BeanShell
Date Wed, 20 Mar 2013 11:58:29 GMT
+1 for last part...

Its a great method to setup your script file in the same element with all
the other static variables (so you can make all changes in a single place.)

On Wed, Mar 20, 2013 at 2:34 AM, Stott, Charlie <CStott@tnsi.com> wrote:

> Hi Jakob,
>
> > * suppose I created a set of functions in an external script file - how
> to call
> > these from my script
>
> a) Read the file into a variable, then 'run' the variable using
> __javaScript function.
>
> Or
>
> b) Use the beanshell pre-processor and enter the filename in the 'Script
> file' field.
>
> > * for this same file: when running in GUI-mode, how to ensure the JMeter
> > has seen these function definitions?
>
> Non-GUI uses the same test plan, not sure what problem you envisage here?
>
> > * Section 16.8 shortly has some 'best practices', where it is mentioned
> that I
> > can 'save a script as a variable' - what does that mean? How do I achieve
> > that? My first guess was to copy/paste the function definition into the
> 'Value'
> > column of a User Defined Variable in the Test Plan, but somehow that
> > completely confuses the interpreter
>
> Almost..
>
> For example, using User Defined Variables:
>
> Name:                           Value:
> SCRIPT_VAR                      if ("${SOME_VAR" != "") {
> vars.put("SOME_VAR", "value");}
>
> Then in another User Defined Variables element (scope means it won't run
> in the same element):
>
> Name:                           Value:
> RUN_SCRIPT                      ${__javaScript(${SCRIPT_VAR})}
>
> I tend to set the scripts early in my test plan, and then invoke them
> where necessary.
>
> Hope that helps.
> Charlie
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

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