Also note that (from docs)
${__BeanShell(source("function.bsh"))} - processes the script in
function.bsh
is what you'd probably use to run a script...
regards
deepak
On Thu, Jul 16, 2009 at 11:23 AM, Deepak Shetty <[email protected]> wrote:
> Hi
> >You mean that RANDOM_NAME contains actual beanshell code?
> Yes.
> >Does it matter that it's Groovy code in a file?
> Never tried it , I dont think it will work. The __Beanshell is only for
> beanshell scripts.
> >And vars.put("GUID", YOURCALCULATEDVALUE) goes where?
> In your Groovy script. You can remove the UDV defn. Once you add a value
> in vars, its available in Jmeter as ${GUID} or vars.get("GUID"). This wont
> be the same for every iteration , as the code would get executed every
> iteration , presumably updating the value. You can see the variables
> available to your script in the sampler..
> regards
> deepak
>
>
> On Thu, Jul 16, 2009 at 11:16 AM, S.D. <[email protected]> wrote:
>
>> Hi ..
>>
>> I'm not sure I understand what you mean .. You mean that RANDOM_NAME
>> contains actual beanshell code? Does it matter that it's Groovy code in
>> a file? Can you provide a simple example so I can just see something
>> working?
>>
>> And vars.put("GUID", YOURCALCULATEDVALUE) goes where? In the value for
>> the UDV ? If that's the case, wouldn't it be the same thing for every
>> iteration? What would be the difference between this and just
>> hard-coding something?
>>
>> Thanks ..
>>
>> On Thu, 2009-07-16 at 11:06 -0700, Deepak Shetty wrote:
>> > In the documentation
>> > RANDOM_NAME is a variable whose value is the actual script contents
>> > that you wish to run. (i.e. the code itself)
>> > If your sampler is working fine , why not just do
>> > vars.put("GUID", YOURCALCULATEDVALUE);
>> >
>> > regards
>> > deepak
>> >
>> > On Thu, Jul 16, 2009 at 10:59 AM, S.D. <[email protected]> wrote:
>> > Hello.
>> >
>> > I am a little confused by how to use the BSF Sampler. I'm
>> > hoping
>> > someone can assist. I'm either misunderstanding the
>> > documentation or am
>> > just not setting it up correctly.
>> >
>> > I have a BSF Sampler that is attached to a groovy script file.
>> > The
>> > sampler runs fine and I see the response.
>> >
>> > I want to capture this response and include it in the Http
>> > header with
>> > my test case.
>> >
>> > I'm not sure how this is supposed to work. I have a UDV,
>> > titled "GUID"
>> > and its set to ${__BeanShell(${RANDOM_NAME})}." In my Http
>> > Headers, I
>> > have a header that is set to ${GUID} but I always see the full
>> > string:
>> > ${__BeanShell(${RANDOM_NAME})}.
>> >
>> > In the JMeter doc, it states:
>> >
>> > "Once the script is working properly, it can be stored as a
>> > variable on
>> > the Test Plan. The script variable can then be used to create
>> > the
>> > function call. For example, suppose a BeanShell script is
>> > stored in the
>> > variable RANDOM_NAME. The function call can then be coded as
>> > ${__BeanShell(${RANDOM_NAME})}."
>> >
>> > What is RANDOM_NAME ? The name of the groovy script file? Is
>> > there a
>> > particular way I need to structure my script? Does it only
>> > work for
>> > BeanShell scripts (.bsh) ? Is the name a filename or
>> > something else?
>> > Does it have to be a PreProcessor or PostProcessor or
>> > Assertion?
>> >
>> > Any assistance is much appreciated.
>> >
>> > Thanks,
>> > --sidd
>> >
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail:
>> > [email protected]
>> > For additional commands, e-mail:
>> > [email protected]
>> >
>> >
>>
>>
>