You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by David Balažic <Da...@comtrade.com> on 2020/06/03 16:06:48 UTC
Evaluation order of functions and variables in JDBC Request sampler
Hi!
What is the evaluation order of functions and variables in a JDBC Request sampler?
What I'm interested in is: are the functions in the query evaluated first and later in the sampler fields like Name and Comments or vice versa?
In an experiment, I discovered that the query is run first, then the Name field.
What I did was to enter in the Query part:
${__setProperty(testabc,aaa)}
prop: ${__P(testabc)}
And in the name of the sampler: prop in name: ${__P(testabc)}
When run, the sample name was (in the Results Tree) : prop in name: aaa
If I put this as name: testing ${__setProperty(testxyz,aaa)}
And in the query field: prop: ${__P(testxyz)}
Then the query did not see the property, the resulting text was: prop: 1 # as the property is unset, it evaluates to 1
Is this official? In other words: can I rely on it not changing in future versions?
I used JMeter 5.3 for this test.
Lep pozdrav,
David Balažic
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
RE: Evaluation order of functions and variables in JDBC Request sampler
Posted by David Balažic <Da...@comtrade.com>.
Felix Schumacher wrote:
> Am 03.06.20 um 18:06 schrieb David Balažic:
> > Hi!
> >
> > What is the evaluation order of functions and variables in a JDBC Request sampler?
> >
> > What I'm interested in is: are the functions in the query evaluated first and later in the sampler fields like Name and Comments or vice versa?
>
> I would be interested, why would you like to rely on the order of the initialization of fields in one sampler?
I set some values (using the __split function) and it must be executed before the results are used.
> > In an experiment, I discovered that the query is run first, then the Name field.
> >
> > What I did was to enter in the Query part:
> >
> > ${__setProperty(testabc,aaa)}
> > prop: ${__P(testabc)}
>
> Why are you using properties instead of variables?
This was just for test, to see the evaluation order.
> > And in the name of the sampler: prop in name: ${__P(testabc)}
> >
> > When run, the sample name was (in the Results Tree) : prop in name:
> > aaa
> >
> > If I put this as name: testing ${__setProperty(testxyz,aaa)} And in
> > the query field: prop: ${__P(testxyz)}
> >
> > Then the query did not see the property, the resulting text was: prop:
> > 1 # as the property is unset, it evaluates to 1
> >
> > Is this official? In other words: can I rely on it not changing in future versions?
>
> I would not rely on this undocumented "feature". I am not aware, that we guarantee the order of inner field initialization of samplers.
>
> Have you looked at pre-/post-processors to initialize variables before or after a sampler?
I'll look into it, thanks.
Lp,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: Evaluation order of functions and variables in JDBC Request
sampler
Posted by Felix Schumacher <fe...@internetallee.de>.
Am 03.06.20 um 18:06 schrieb David Balažic:
> Hi!
>
> What is the evaluation order of functions and variables in a JDBC Request sampler?
>
> What I'm interested in is: are the functions in the query evaluated first and later in the sampler fields like Name and Comments or vice versa?
I would be interested, why would you like to rely on the order of the
initialization of fields in one sampler?
>
> In an experiment, I discovered that the query is run first, then the Name field.
>
> What I did was to enter in the Query part:
>
> ${__setProperty(testabc,aaa)}
> prop: ${__P(testabc)}
Why are you using properties instead of variables?
>
> And in the name of the sampler: prop in name: ${__P(testabc)}
>
> When run, the sample name was (in the Results Tree) : prop in name: aaa
>
> If I put this as name: testing ${__setProperty(testxyz,aaa)}
> And in the query field: prop: ${__P(testxyz)}
>
> Then the query did not see the property, the resulting text was: prop: 1 # as the property is unset, it evaluates to 1
>
> Is this official? In other words: can I rely on it not changing in future versions?
I would not rely on this undocumented "feature". I am not aware, that we
guarantee the order of inner field initialization of samplers.
Have you looked at pre-/post-processors to initialize variables before
or after a sampler?
Felix
>
> I used JMeter 5.3 for this test.
>
> Lep pozdrav,
> David Balažic
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org