You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "Raghav, Pushpendra" <Pu...@marsh.com> on 2017/08/22 19:29:59 UTC

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.
**********************************************************************

Re: Not able to parameterize File Path\Name

Posted by Felix Schumacher <fe...@internetallee.de>.
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.
> **********************************************************************