jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: Programmatically updating file path for sending files with an HTTP Request in Apache JMeter
Date Wed, 06 Jun 2012 21:14:03 GMT
Hello,
It is failing because you use \${FILENAME}

This escapes $ so variable is not interpreted.

Solution:

   - C:\\Installs\\Apache Jmeter\\apache-jmeter-2.7\\bin\\${FILENAME} (I
   cannot test as I am on Mac OS)

or

   - C:/Installs/Apache Jmeter/apache-jmeter-2.7/bin/${FILENAME} (this
   works on Windows sure)


Regards
Philippe M.
http://www.ubik-ingenierie.com

On Wed, Jun 6, 2012 at 10:54 PM, <Will.Henry@hcahealthcare.com> wrote:

> Hey all,
>
> I am using Apache JMeter 2.7 to load test Liferay. One such test I am
> creating involves dynamically generating files and uploading them to
> Liferay's Document and Media portlet. The problem I'm having has nothing to
> do with Liferay though...I know this because I can upload a document if I
> type the exact path into the "file path" box of "Send Files With the
> Request" in an HTTP request. This is not how I need the test to run.
>
> I want the test to run in such a way that I generate a unique file each
> loop of the test with a different UUID for the file name(I do so in a
> BeanShell PreProcessor and it does as I want). I have a user defined
> variable FILENAME that I use to store the file name. In the HTTP Request,
> for the file path I use the path "C:\Installs\Apache
> Jmeter\apache-jmeter-2.7\bin\${FILENAME}" but JMeter does not process the
> variable. When I view the Results Tree, I see the error:
>
> java.io.FileNotFoundException: C:\Installs\Apache
> Jmeter\apache-jmeter-2.7\bin\${FILENAME} (The system cannot find the file
> specified)
>
> Yet, if I hard code the file path(for example ...\bin\doc.txt) and use
> ${FILENAME} as the value for the title of the document(a parameter I send
> in the HTTP Request), the document(doc.txt) uploads to the portlet with the
> string value of FILENAME as the title. This lets me know the right string
> is stored in the variable FILENAME. From this, I deduce that JMeter simply
> does not replace variables in the file path for sending files in an HTTP
> Request. If I am incorrect in this conclusion, please let me know how to
> fix whatever error I have. Has anyone else had this problem?
>
> I am currently trying to create a work around by adding a BeanShell
> PreProcessor to this http request that would dynamically update the
> filepath with the variable name. I would need to set some variable =
> vars.get("FILENAME"). Anyone know how to proceed from here to set the HTTP
> file path programmatically? I'm looking in the API
> http://jmeter.apache.org/api/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.htmlfor
the answer. Any help would be much appreciated because I am completely
> stumped right now.
>
> I've tried making this PreProcessor myself, but it does not work:
>
>            HTTPFileArg file = new HTTPFileArg("C:\Installs\Apache
> Jmeter\apache-jmeter-2.7\bin\doc.txt", "_20_file", "text/plain");
>
> sampler.setHTTPFiles(file);
>
>
>
> I've seen similar questions but none of the answer helped me and I haven't
> ever seen someone do what I want to do programmatically.
>
> Thanks,
>
> Will Henry
>
>


-- 
Cordialement.
Philippe Mouawad.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message