You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by harry_no_spot <13...@163.com> on 2016/08/11 13:32:01 UTC

how to evaluate function set in variable?

hi, plz help me, the question is:
1. senario as expected:
a.create a csv file, contents is
var
123
b.very simple test plan. 'CSV data set config' & 'JSR223 Sampler'
c. println ${__eval(vars.get("var"))}  
it prints 123 on console as expected.

2. senario not as expected
a. change csv file, content is
var
${__time(yyyyMMdd)}
b. it prints ${__time(yyyyMMdd)} on console, not as expected, say, 20160811

so why?


Re: Re: Re:how to evaluate function set in variable?

Posted by Deepak Shetty <sh...@gmail.com>.
what version of Jmeter are you on ? evalVar is available after 2.3.1

On Tue, Aug 16, 2016 at 4:33 AM, harry_no_spot <13...@163.com> wrote:

> evalVar is not suitable:
> Caused by: groovy.lang.MissingPropertyException: No such property:
> println for class: Script10
>
>
>
>
> At 2016-08-16 02:55:43, "Deepak Shetty" <sh...@gmail.com> wrote:
> >vars is not available to __eval function as far as I know . The
> >documentation calls out places where vars is available
> >http://jmeter.apache.org/usermanual/functions.html
> >
> >Also for your usecase , probably evalVar is more suitable ?
> >http://jmeter.apache.org/usermanual/functions.html#__evalVar
> >
> >On Mon, Aug 15, 2016 at 7:48 AM, harry_no_spot <13...@163.com>
> wrote:
> >
> >> Still not understand why
> >> println ${__eval(vars.get("var"))}
> >> will print
> >>
> >> ${__time(yyyyMMdd)}
> >> instead of
> >> 20160815
> >>
> >>
> >>
> >> At 2016-08-15 22:32:11, "harry_no_spot" <13...@163.com> wrote:
> >> >I answer myself.
> >> >use println  ${__eval(${var})}  will be ok
> >> >use println ${__eval(vars.get("var"))} will be not ok.
> >> >
> >> >
> >> >At 2016-08-11 21:32:01, "harry_no_spot" <13...@163.com> wrote:
> >> >>hi, plz help me, the question is:
> >> >>1. senario as expected:
> >> >>a.create a csv file, contents is
> >> >>var
> >> >>123
> >> >>b.very simple test plan. 'CSV data set config' & 'JSR223 Sampler'
> >> >>c. println ${__eval(vars.get("var"))}
> >> >>it prints 123 on console as expected.
> >> >>
> >> >>2. senario not as expected
> >> >>a. change csv file, content is
> >> >>var
> >> >>${__time(yyyyMMdd)}
> >> >>b. it prints ${__time(yyyyMMdd)} on console, not as expected, say,
> >> 20160811
> >> >>
> >> >>so why?
> >> >>
> >>
>

Re:Re: Re:how to evaluate function set in variable?

Posted by harry_no_spot <13...@163.com>.
evalVar is not suitable:
Caused by: groovy.lang.MissingPropertyException: No such property: println for class: Script10




At 2016-08-16 02:55:43, "Deepak Shetty" <sh...@gmail.com> wrote:
>vars is not available to __eval function as far as I know . The
>documentation calls out places where vars is available
>http://jmeter.apache.org/usermanual/functions.html
>
>Also for your usecase , probably evalVar is more suitable ?
>http://jmeter.apache.org/usermanual/functions.html#__evalVar
>
>On Mon, Aug 15, 2016 at 7:48 AM, harry_no_spot <13...@163.com> wrote:
>
>> Still not understand why
>> println ${__eval(vars.get("var"))}
>> will print
>>
>> ${__time(yyyyMMdd)}
>> instead of
>> 20160815
>>
>>
>>
>> At 2016-08-15 22:32:11, "harry_no_spot" <13...@163.com> wrote:
>> >I answer myself.
>> >use println  ${__eval(${var})}  will be ok
>> >use println ${__eval(vars.get("var"))} will be not ok.
>> >
>> >
>> >At 2016-08-11 21:32:01, "harry_no_spot" <13...@163.com> wrote:
>> >>hi, plz help me, the question is:
>> >>1. senario as expected:
>> >>a.create a csv file, contents is
>> >>var
>> >>123
>> >>b.very simple test plan. 'CSV data set config' & 'JSR223 Sampler'
>> >>c. println ${__eval(vars.get("var"))}
>> >>it prints 123 on console as expected.
>> >>
>> >>2. senario not as expected
>> >>a. change csv file, content is
>> >>var
>> >>${__time(yyyyMMdd)}
>> >>b. it prints ${__time(yyyyMMdd)} on console, not as expected, say,
>> 20160811
>> >>
>> >>so why?
>> >>
>>

Re: Re:how to evaluate function set in variable?

Posted by Deepak Shetty <sh...@gmail.com>.
vars is not available to __eval function as far as I know . The
documentation calls out places where vars is available
http://jmeter.apache.org/usermanual/functions.html

Also for your usecase , probably evalVar is more suitable ?
http://jmeter.apache.org/usermanual/functions.html#__evalVar

On Mon, Aug 15, 2016 at 7:48 AM, harry_no_spot <13...@163.com> wrote:

> Still not understand why
> println ${__eval(vars.get("var"))}
> will print
>
> ${__time(yyyyMMdd)}
> instead of
> 20160815
>
>
>
> At 2016-08-15 22:32:11, "harry_no_spot" <13...@163.com> wrote:
> >I answer myself.
> >use println  ${__eval(${var})}  will be ok
> >use println ${__eval(vars.get("var"))} will be not ok.
> >
> >
> >At 2016-08-11 21:32:01, "harry_no_spot" <13...@163.com> wrote:
> >>hi, plz help me, the question is:
> >>1. senario as expected:
> >>a.create a csv file, contents is
> >>var
> >>123
> >>b.very simple test plan. 'CSV data set config' & 'JSR223 Sampler'
> >>c. println ${__eval(vars.get("var"))}
> >>it prints 123 on console as expected.
> >>
> >>2. senario not as expected
> >>a. change csv file, content is
> >>var
> >>${__time(yyyyMMdd)}
> >>b. it prints ${__time(yyyyMMdd)} on console, not as expected, say,
> 20160811
> >>
> >>so why?
> >>
>

Re:Re:how to evaluate function set in variable?

Posted by harry_no_spot <13...@163.com>.
Still not understand why
println ${__eval(vars.get("var"))}
will print

${__time(yyyyMMdd)}
instead of
20160815



At 2016-08-15 22:32:11, "harry_no_spot" <13...@163.com> wrote:
>I answer myself.
>use println  ${__eval(${var})}  will be ok
>use println ${__eval(vars.get("var"))} will be not ok.
>
>
>At 2016-08-11 21:32:01, "harry_no_spot" <13...@163.com> wrote:
>>hi, plz help me, the question is:
>>1. senario as expected:
>>a.create a csv file, contents is
>>var
>>123
>>b.very simple test plan. 'CSV data set config' & 'JSR223 Sampler'
>>c. println ${__eval(vars.get("var"))}  
>>it prints 123 on console as expected.
>>
>>2. senario not as expected
>>a. change csv file, content is
>>var
>>${__time(yyyyMMdd)}
>>b. it prints ${__time(yyyyMMdd)} on console, not as expected, say, 20160811
>>
>>so why?
>>

Re:how to evaluate function set in variable?

Posted by harry_no_spot <13...@163.com>.
I answer myself.
use println  ${__eval(${var})}  will be ok
use println ${__eval(vars.get("var"))} will be not ok.


At 2016-08-11 21:32:01, "harry_no_spot" <13...@163.com> wrote:
>hi, plz help me, the question is:
>1. senario as expected:
>a.create a csv file, contents is
>var
>123
>b.very simple test plan. 'CSV data set config' & 'JSR223 Sampler'
>c. println ${__eval(vars.get("var"))}  
>it prints 123 on console as expected.
>
>2. senario not as expected
>a. change csv file, content is
>var
>${__time(yyyyMMdd)}
>b. it prints ${__time(yyyyMMdd)} on console, not as expected, say, 20160811
>
>so why?
>