You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Morten Kristiansen <mo...@tracetracker.com> on 2011/10/21 15:38:23 UTC
Iterate over files
Hi,
I want to create a JMeter test that executes a HTTP Request POST with a file
attached to it. So far so good (I know how to do that). But my files are in
a directory and I don't know the filenames or how many files. So what I need
is to prior to the HTTP Request, look into a given directory and get a list
of all files in that directory. Then I want to loop over these files and
execute a HTTP Request for each of them.
I have googled for 2 hours and can't find a single example on how to acheive
this. Can anyone help?
Thanks,
Morten
Re: Iterate over files
Posted by chaitanya bhatt <bh...@gmail.com>.
Use the standard *BeanShell* commands: cat(); *cd*(); cp(); mv(); rm(); *dir
*();; You can call external commands as exec("command");
Thanks
Chaitanya M Bhatt
http://www.performancecompetence.com
On Fri, Oct 21, 2011 at 6:38 AM, Morten Kristiansen <morten@tracetracker.com
> wrote:
> Hi,
>
> I want to create a JMeter test that executes a HTTP Request POST with a
> file
> attached to it. So far so good (I know how to do that). But my files are in
> a directory and I don't know the filenames or how many files. So what I
> need
> is to prior to the HTTP Request, look into a given directory and get a
> list
> of all files in that directory. Then I want to loop over these files and
> execute a HTTP Request for each of them.
>
> I have googled for 2 hours and can't find a single example on how to
> acheive
> this. Can anyone help?
>
> Thanks,
>
> Morten
>
Re: Iterate over files
Posted by sebb <se...@gmail.com>.
On 21 October 2011 14:38, Morten Kristiansen <mo...@tracetracker.com> wrote:
> Hi,
>
> I want to create a JMeter test that executes a HTTP Request POST with a file
> attached to it. So far so good (I know how to do that). But my files are in
> a directory and I don't know the filenames or how many files. So what I need
> is to prior to the HTTP Request, look into a given directory and get a list
> of all files in that directory. Then I want to loop over these files and
> execute a HTTP Request for each of them.
>
> I have googled for 2 hours and can't find a single example on how to acheive
> this. Can anyone help?
Not possible without writing some code.
I'd suggest looking at the CSV Dataset config element
http://jakarta.apache.org/jmeter/usermanual/component_reference.html#CSV_Data_Set_Config
which can read a file of text and store it in variables.
All you need to do is use a directory listing program to create the
file of names, then run JMeter.
> Thanks,
>
> Morten
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org