Not able to parameterize File Path\Name

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

Not able to parameterize File Path\Name

Raghav, Pushpendra

Hi ,

 

I read many blogs and article which suggest that path of a CSV Data file can be parameterized to pick a different file in run time.

 

They suggest doing following way :

 

1.       Create  Beanshell sampler and add this code in it : - props.put(“path”,"/apache-jmeter-3.2/Data/accountID.csv");

2.       Use ${__P(vars.get(“path”))} to replace value of path in “Filename” text box of CSV Data set config.

 

 

But I get an error in logs : File 1 must exist and be readable. Some times I get message that File path must exist and be readable.

 

Overall looks like _P function  is not successfully replacing value of path with the value assigned in Beanshell sampler. Can you please help if I am using wrong syntax or if there should be any other better way to parameterize Filename ?

 

Thanks

Pushpendra Singh Raghav

 

 





**********************************************************************
This e-mail transmission and any attachments that accompany it may
contain information that is privileged, confidential or otherwise
exempt from disclosure under applicable law and is intended solely for
the use of the individual(s) to whom it was intended to be addressed.
If you have received this e-mail by mistake, or you are not the
intended recipient, any disclosure, dissemination, distribution,
copying or other use or retention of this communication or its
substance is prohibited. If you have received this communication in
error, please immediately reply to the author via e-mail that you
received this message by mistake and also permanently delete the
original and all copies of this e-mail and any attachments from your
computer. Thank you.
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

RE: Not able to parameterize File Path\Name

Raghav, Pushpendra
Hi , [Just made correction in 2nd point.]

I read many blogs and article which suggest that path of a CSV Data file can be parameterized to pick a different file in run time.

They suggest doing following way :


1.       Create  Beanshell sampler and add this code in it : - props.put("path","/apache-jmeter-3.2/Data/accountID.csv");

2.       Use ${__P("path")} to replace value of path in "Filename" text box of CSV Data set config.  [just corrected this statement]


But I get an error in logs : File 1 must exist and be readable. Some times I get message that File path must exist and be readable.

Overall looks like _P function  is not successfully replacing value of path with the value assigned in Beanshell sampler. Can you please help if I am using wrong syntax or if there should be any other better way to parameterize Filename ?

Thanks
Pushpendra Singh Raghav



From: Raghav, Pushpendra
Sent: Tuesday, August 22, 2017 3:30 PM
To: [hidden email]
Subject: Not able to parameterize File Path\Name

Hi ,

I read many blogs and article which suggest that path of a CSV Data file can be parameterized to pick a different file in run time.

They suggest doing following way :


1.       Create  Beanshell sampler and add this code in it : - props.put("path","/apache-jmeter-3.2/Data/accountID.csv");

2.       Use ${__P(vars.get("path"))} to replace value of path in "Filename" text box of CSV Data set config.

[cid:image001.png@01D31B5A.A887B930]

But I get an error in logs : File 1 must exist and be readable. Some times I get message that File path must exist and be readable.

Overall looks like _P function  is not successfully replacing value of path with the value assigned in Beanshell sampler. Can you please help if I am using wrong syntax or if there should be any other better way to parameterize Filename ?

Thanks
Pushpendra Singh Raghav



________________________________


**********************************************************************
This e-mail transmission and any attachments that accompany it may
contain information that is privileged, confidential or otherwise
exempt from disclosure under applicable law and is intended solely for
the use of the individual(s) to whom it was intended to be addressed.
If you have received this e-mail by mistake, or you are not the
intended recipient, any disclosure, dissemination, distribution,
copying or other use or retention of this communication or its
substance is prohibited. If you have received this communication in
error, please immediately reply to the author via e-mail that you
received this message by mistake and also permanently delete the
original and all copies of this e-mail and any attachments from your
computer. Thank you.
**********************************************************************

________________________________


**********************************************************************
This e-mail transmission and any attachments that accompany it may
contain information that is privileged, confidential or otherwise
exempt from disclosure under applicable law and is intended solely for
the use of the individual(s) to whom it was intended to be addressed.
If you have received this e-mail by mistake, or you are not the
intended recipient, any disclosure, dissemination, distribution,
copying or other use or retention of this communication or its
substance is prohibited. If you have received this communication in
error, please immediately reply to the author via e-mail that you
received this message by mistake and also permanently delete the
original and all copies of this e-mail and any attachments from your
computer. Thank you.
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Not able to parameterize File Path\Name

Felix Schumacher
In reply to this post by Raghav, Pushpendra
Hi,

the list strips off images quite regularly, so we can't see, what you
have done. Try to describe your test case in words.

Am 22.08.2017 um 21:29 schrieb Raghav, Pushpendra:

>
> Hi ,
>
> I read many blogs and article which suggest that path of a CSV Data
> file can be parameterized to pick a different file in run time.
>
> They suggest doing following way :
>
> 1.Create  Beanshell sampler and add this code in it : -
> props.put(“path”,"/apache-jmeter-3.2/Data/accountID.csv");
>
> 2.Use ${__P(vars.get(“path”))} to replace value of path in “Filename”
> text box of CSV Data set config.
>
I guess, that the property gets read, before the beanshell sets prop.
You might want to look at the __log function, that logs the return value
of some expression, before it passes it on. So try ${__log(__P(..))}.

Regards,
  Felix

>
> But I get an error in logs : File 1 must exist and be readable. Some
> times I get message that File path must exist and be readable.
>
> Overall looks like _P function  is not successfully replacing value of
> path with the value assigned in Beanshell sampler. Can you please help
> if I am using wrong syntax or if there should be any other better way
> to parameterize Filename ?
>
> Thanks
>
> Pushpendra /Singh/ Raghav
>
>
> ------------------------------------------------------------------------
>
>
> **********************************************************************
> This e-mail transmission and any attachments that accompany it may
> contain information that is privileged, confidential or otherwise
> exempt from disclosure under applicable law and is intended solely for
> the use of the individual(s) to whom it was intended to be addressed.
> If you have received this e-mail by mistake, or you are not the
> intended recipient, any disclosure, dissemination, distribution,
> copying or other use or retention of this communication or its
> substance is prohibited. If you have received this communication in
> error, please immediately reply to the author via e-mail that you
> received this message by mistake and also permanently delete the
> original and all copies of this e-mail and any attachments from your
> computer. Thank you.
> **********************************************************************