Jmeter not substituting variable in CSV Data Set Config

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Jmeter not substituting variable in CSV Data Set Config

Krister Nilsson

Hi!

 

I have this problem when using a variable to point out the test data file (<path>\sit_tel.csv in my case below) in CSV Data Set Config, that Jmeter does not substitute the variable and thus complaing about not finding ${testdata}, pls see clip from log file below:

 

2021-04-07 12:27:36,201 INFO o.a.j.t.JMeterThread: Thread started: Loop per test environment 1-1

2021-04-07 12:27:36,217 INFO o.a.j.p.j.s.J.Set hosts, paths and files: ---- Loop number 1 means SIT-TEL ----

2021-04-07 12:27:36,217 INFO o.a.j.p.j.s.J.Set hosts, paths and files: testdata = C:\cygwin64\home\krinis_adm\jmeter\testplan\overvakning\sit_tel.csv

2021-04-07 12:27:36,217 INFO o.a.j.s.FileServer: Stored: ${testdata}

2021-04-07 12:27:36,217 ERROR o.a.j.t.JMeterThread: Test failed!

java.lang.IllegalArgumentException: File ${testdata} must exist and be readable

          at org.apache.jmeter.services.FileServer.createBufferedReader(FileServer.java:425) ~[ApacheJMeter_core.jar:5.2.1]

          at org.apache.jmeter.services.FileServer.getReader(FileServer.java:391) ~[ApacheJMeter_core.jar:5.2.1]

          at org.apache.jmeter.services.FileServer.getParsedLine(FileServer.java:373) ~[ApacheJMeter_core.jar:5.2.1]

          at org.apache.jmeter.config.CSVDataSet.iterationStart(CSVDataSet.java:208) ~[ApacheJMeter_components.jar:5.2.1]

 

The code (JSR223 sampler) generating the INFO log line above FileServer’s looks like this:

vars.put("testdata",vars.get("csvPath")+"\\sit_tel.csv");

vars.put("props_folder","overvakning_props_sit_tel");

log.info("---- Loop number "+loop_no+" means SIT-TEL ----");

log.info("testdata = "+vars.get("testdata"));

 

The Test Plan looks like this (hope it is clear enough…):

 

I can see in the “Debug Sampler AP37” that the the variable ${testdata} is correctly defined with a correct value.

 

Med vänlig hälsning
Krister Nilsson
____________________________________________________________

Krister Nilsson / översteprest, prestandatest

IT Fond konto och teknisk plattform
Telefon direkt 010-454 21 97, mobil 072-210 21 97
[hidden email]

Pensionsmyndigheten,
Telefon vxl 0771-771 771, fax 08-658 13 00, www.pensionsmyndigheten.se


P Överväg miljöpåverkan innan du skriver ut detta e-brev.

 

Reply | Threaded
Open this post in threaded view
|

Re: Jmeter not substituting variable in CSV Data Set Config

glinius@live.com
Of course it doesn't. Could you please bookmark the  Execution Order
<https://jmeter.apache.org/usermanual/test_plan.html#executionorder>  
chapter and re-read it prior to asking the next question.


CSV Data Set Config is a *Configuration Element* so it's being executed
before the JSR223 Sampler and in fact before everything else.

The only configuration element which takes precedence is  User Defined
Variables
<https://guide.blazemeter.com/hc/en-us/articles/207421395-Using-User-Defined-Variables-Using-User-Defined-Variables>  
so you can define your *testdata* variable there and if you want to make it
dynamic - use __groovy() function
<https://jmeter.apache.org/usermanual/functions.html#__groovy>   to
calculate/assign the value.





--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

SV: Jmeter not substituting variable in CSV Data Set Config

Krister Nilsson
[hidden email]!

That was a pretty arrogant answer! I refrain myself from further discussion though, except that proposing that patience is a virtue if you're working for a support organization.

I do apologize for being a bit ignorant myself not thinking about the execution order in this case. I think however, that I am not the only one thinking that Jmeter is not very intuitive. It is not uncommon with tools where things are actually executed in the "order of appearance". There may be good reasons for why it is like it is now, but allow me to ask why, if a Configuration Element is always executed prior to all other, is it allowed to be placed (almost) anywhere? Perhaps an area for improvement?

Thanks a lot for your answer!
BR
/Krister

-----Ursprungligt meddelande-----
Från: [hidden email] <[hidden email]>
Skickat: den 7 april 2021 13:01
Till: [hidden email]
Ämne: Re: Jmeter not substituting variable in CSV Data Set Config

Of course it doesn't. Could you please bookmark the  Execution Order
<https://jmeter.apache.org/usermanual/test_plan.html#executionorder>  
chapter and re-read it prior to asking the next question.


CSV Data Set Config is a *Configuration Element* so it's being executed before the JSR223 Sampler and in fact before everything else.

The only configuration element which takes precedence is  User Defined Variables <https://guide.blazemeter.com/hc/en-us/articles/207421395-Using-User-Defined-Variables-Using-User-Defined-Variables>
so you can define your *testdata* variable there and if you want to make it dynamic - use __groovy() function
<https://jmeter.apache.org/usermanual/functions.html#__groovy>   to
calculate/assign the value.





--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Jmeter not substituting variable in CSV Data Set Config

Philippe Mouawad
Hello Krister,

I'm sorry for your experience in this mailing list, the person who tried to
help you here is not a member of the project.
I guess his contributions help users, but sometimes the tone used is not
the most appropriate.

Now, regarding the order of execution, I was not working on the project
when it was decided, but from my experience and understanding, the order is
due to the fact that in
Configuration elements, we usually want to setup something before executing
any sampler, that's why the order in Plan does not apply and we rely on
scope instead as explained in reference documentation

   -
   https://jmeter.apache.org/usermanual/component_reference.html#config_elements


Scoping concept is another very important concept to understand besides the
order:

   - https://jmeter.apache.org/usermanual/test_plan.html#scoping_rules


I agree it is not very intuitive for beginners  but it has pro/cons.

Regarding your case, having this in mind, you should rely on Properties
instead of Variables for CSV Data Set filename configuration, see this for
Vars vs Properties

   - https://jmeter.apache.org/usermanual/functions.html

I hope this helps.

Regards
Philippe M.
https://leanpub.com/master-jmeter-from-load-test-to-devops
On Wed, Apr 7, 2021 at 2:17 PM Krister Nilsson <
[hidden email]> wrote:

> [hidden email]!
>
> That was a pretty arrogant answer! I refrain myself from further
> discussion though, except that proposing that patience is a virtue if
> you're working for a support organization.
>
> I do apologize for being a bit ignorant myself not thinking about the
> execution order in this case. I think however, that I am not the only one
> thinking that Jmeter is not very intuitive. It is not uncommon with tools
> where things are actually executed in the "order of appearance". There may
> be good reasons for why it is like it is now, but allow me to ask why, if a
> Configuration Element is always executed prior to all other, is it allowed
> to be placed (almost) anywhere? Perhaps an area for improvement?
>
> Thanks a lot for your answer!
> BR
> /Krister
>
> -----Ursprungligt meddelande-----
> Från: [hidden email] <[hidden email]>
> Skickat: den 7 april 2021 13:01
> Till: [hidden email]
> Ämne: Re: Jmeter not substituting variable in CSV Data Set Config
>
> Of course it doesn't. Could you please bookmark the  Execution Order
> <https://jmeter.apache.org/usermanual/test_plan.html#executionorder>
> chapter and re-read it prior to asking the next question.
>
>
> CSV Data Set Config is a *Configuration Element* so it's being executed
> before the JSR223 Sampler and in fact before everything else.
>
> The only configuration element which takes precedence is  User Defined
> Variables <
> https://guide.blazemeter.com/hc/en-us/articles/207421395-Using-User-Defined-Variables-Using-User-Defined-Variables
> >
> so you can define your *testdata* variable there and if you want to make
> it dynamic - use __groovy() function
> <https://jmeter.apache.org/usermanual/functions.html#__groovy>   to
> calculate/assign the value.
>
>
>
>
>
> --
> Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Cordialement
Philippe M.
Ubik-Ingenierie
Philippe M.
@philmdot
http://ubikloadpack.com
Reply | Threaded
Open this post in threaded view
|

SV: Jmeter not substituting variable in CSV Data Set Config

Krister Nilsson
Hi Philippe!

No worries! I guess we have to live with not everyone using the same tone in a society like this. glinius helped me with what was wrong at least, even though it is a little tricky to solve my use case under the existing circumstances. I have a workaround at least.

I wouldn't call myself a beginner, but there is certainly a lot left to learn. Jmeter is in many ways a very powerful tool, but the frustration sometimes get rather big since there seems to be so many special cases. To take a bigger grip on the intuitivity issue would probably be a large project, but would mean an improvement I believe.

In my case I did try properties instead of variables, but it didn't make any difference. Of course it is possible that I made some additional mistake...

Thanks and regards
/Krister


-----Ursprungligt meddelande-----
Från: Philippe Mouawad <[hidden email]>
Skickat: den 7 april 2021 14:39
Till: JMeter Users List <[hidden email]>
Ämne: Re: Jmeter not substituting variable in CSV Data Set Config

Hello Krister,

I'm sorry for your experience in this mailing list, the person who tried to help you here is not a member of the project.
I guess his contributions help users, but sometimes the tone used is not the most appropriate.

Now, regarding the order of execution, I was not working on the project when it was decided, but from my experience and understanding, the order is due to the fact that in Configuration elements, we usually want to setup something before executing any sampler, that's why the order in Plan does not apply and we rely on scope instead as explained in reference documentation

   -
   https://jmeter.apache.org/usermanual/component_reference.html#config_elements


Scoping concept is another very important concept to understand besides the
order:

   - https://jmeter.apache.org/usermanual/test_plan.html#scoping_rules


I agree it is not very intuitive for beginners  but it has pro/cons.

Regarding your case, having this in mind, you should rely on Properties instead of Variables for CSV Data Set filename configuration, see this for Vars vs Properties

   - https://jmeter.apache.org/usermanual/functions.html

I hope this helps.

Regards
Philippe M.
https://leanpub.com/master-jmeter-from-load-test-to-devops
On Wed, Apr 7, 2021 at 2:17 PM Krister Nilsson < [hidden email]> wrote:

> [hidden email]!
>
> That was a pretty arrogant answer! I refrain myself from further
> discussion though, except that proposing that patience is a virtue if
> you're working for a support organization.
>
> I do apologize for being a bit ignorant myself not thinking about the
> execution order in this case. I think however, that I am not the only
> one thinking that Jmeter is not very intuitive. It is not uncommon
> with tools where things are actually executed in the "order of
> appearance". There may be good reasons for why it is like it is now,
> but allow me to ask why, if a Configuration Element is always executed
> prior to all other, is it allowed to be placed (almost) anywhere? Perhaps an area for improvement?
>
> Thanks a lot for your answer!
> BR
> /Krister
>
> -----Ursprungligt meddelande-----
> Från: [hidden email] <[hidden email]>
> Skickat: den 7 april 2021 13:01
> Till: [hidden email]
> Ämne: Re: Jmeter not substituting variable in CSV Data Set Config
>
> Of course it doesn't. Could you please bookmark the  Execution Order
> <https://jmeter.apache.org/usermanual/test_plan.html#executionorder>
> chapter and re-read it prior to asking the next question.
>
>
> CSV Data Set Config is a *Configuration Element* so it's being
> executed before the JSR223 Sampler and in fact before everything else.
>
> The only configuration element which takes precedence is  User Defined
> Variables <
> https://guide.blazemeter.com/hc/en-us/articles/207421395-Using-User-De
> fined-Variables-Using-User-Defined-Variables
> >
> so you can define your *testdata* variable there and if you want to
> make it dynamic - use __groovy() function
> <https://jmeter.apache.org/usermanual/functions.html#__groovy>   to
> calculate/assign the value.
>
>
>
>
>
> --
> Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Cordialement
Philippe M.
Ubik-Ingenierie

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: SV: Jmeter not substituting variable in CSV Data Set Config

Felix Schumacher

Am 07.04.21 um 15:48 schrieb Krister Nilsson:
> Hi Philippe!
>
> No worries! I guess we have to live with not everyone using the same tone in a society like this. glinius helped me with what was wrong at least, even though it is a little tricky to solve my use case under the existing circumstances. I have a workaround at least.
>
> I wouldn't call myself a beginner, but there is certainly a lot left to learn. Jmeter is in many ways a very powerful tool, but the frustration sometimes get rather big since there seems to be so many special cases. To take a bigger grip on the intuitivity issue would probably be a large project, but would mean an improvement I believe.
>
> In my case I did try properties instead of variables, but it didn't make any difference. Of course it is possible that I made some additional mistake...

It helps, if you try to setup a minimal test plan to work on these
issues. That would have at least two positive results. First it should
work (and be easier to understand) and second  you could send those
minimal tests to the mailing list. Then we could try to help you better
with those corner cases.

How did you define the property?

Felix

>
> Thanks and regards
> /Krister
>
>
> -----Ursprungligt meddelande-----
> Från: Philippe Mouawad <[hidden email]>
> Skickat: den 7 april 2021 14:39
> Till: JMeter Users List <[hidden email]>
> Ämne: Re: Jmeter not substituting variable in CSV Data Set Config
>
> Hello Krister,
>
> I'm sorry for your experience in this mailing list, the person who tried to help you here is not a member of the project.
> I guess his contributions help users, but sometimes the tone used is not the most appropriate.
>
> Now, regarding the order of execution, I was not working on the project when it was decided, but from my experience and understanding, the order is due to the fact that in Configuration elements, we usually want to setup something before executing any sampler, that's why the order in Plan does not apply and we rely on scope instead as explained in reference documentation
>
>    -
>    https://jmeter.apache.org/usermanual/component_reference.html#config_elements
>
>
> Scoping concept is another very important concept to understand besides the
> order:
>
>    - https://jmeter.apache.org/usermanual/test_plan.html#scoping_rules
>
>
> I agree it is not very intuitive for beginners  but it has pro/cons.
>
> Regarding your case, having this in mind, you should rely on Properties instead of Variables for CSV Data Set filename configuration, see this for Vars vs Properties
>
>    - https://jmeter.apache.org/usermanual/functions.html
>
> I hope this helps.
>
> Regards
> Philippe M.
> https://leanpub.com/master-jmeter-from-load-test-to-devops
> On Wed, Apr 7, 2021 at 2:17 PM Krister Nilsson < [hidden email]> wrote:
>
>> [hidden email]!
>>
>> That was a pretty arrogant answer! I refrain myself from further
>> discussion though, except that proposing that patience is a virtue if
>> you're working for a support organization.
>>
>> I do apologize for being a bit ignorant myself not thinking about the
>> execution order in this case. I think however, that I am not the only
>> one thinking that Jmeter is not very intuitive. It is not uncommon
>> with tools where things are actually executed in the "order of
>> appearance". There may be good reasons for why it is like it is now,
>> but allow me to ask why, if a Configuration Element is always executed
>> prior to all other, is it allowed to be placed (almost) anywhere? Perhaps an area for improvement?
>>
>> Thanks a lot for your answer!
>> BR
>> /Krister
>>
>> -----Ursprungligt meddelande-----
>> Från: [hidden email] <[hidden email]>
>> Skickat: den 7 april 2021 13:01
>> Till: [hidden email]
>> Ämne: Re: Jmeter not substituting variable in CSV Data Set Config
>>
>> Of course it doesn't. Could you please bookmark the  Execution Order
>> <https://jmeter.apache.org/usermanual/test_plan.html#executionorder>
>> chapter and re-read it prior to asking the next question.
>>
>>
>> CSV Data Set Config is a *Configuration Element* so it's being
>> executed before the JSR223 Sampler and in fact before everything else.
>>
>> The only configuration element which takes precedence is  User Defined
>> Variables <
>> https://guide.blazemeter.com/hc/en-us/articles/207421395-Using-User-De
>> fined-Variables-Using-User-Defined-Variables
>> so you can define your *testdata* variable there and if you want to
>> make it dynamic - use __groovy() function
>> <https://jmeter.apache.org/usermanual/functions.html#__groovy>   to
>> calculate/assign the value.
>>
>>
>>
>>
>>
>> --
>> Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
> --
> Cordialement
> Philippe M.
> Ubik-Ingenierie
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


OpenPGP_signature (855 bytes) Download Attachment