7

I've got a problem using tsung:

I've got several files in one dir wich I have to send to the server. I create file with list of this files (fullpath) and add an option to tsung config:

 <option name="file_server" id="xml_files" value="/home/ubuntu/.tsung/files"></option>

My goal is to pick a random filepath from this file and send to the server. To do so I wrote this part of config:

  <setdynvars sourcetype="file" fileid="xml_files" delimiter=";"
order="random">
       <var name="file_name" />
     </setdynvars>

     <request subst="true">
           <http url="/" version="1.1" method="POST"
contents_from_file="%%_file_name%%"></http>
     </request>

But this do not work. When I set attr contents_from_file as constant everything works fine. Is there any way to do this with variable?

Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
exabiche
  • 2,895
  • 2
  • 17
  • 10
  • 2
    FWIW, this is not possible (yet.) I've created a ticket at https://support.process-one.net/browse/TSUN-233 – Simon Nov 21 '12 at 22:26

1 Answers1

3

I got the similar thing working, i am using tsung 1.5.0. you may want to try:

<request subst="true">
           <http url="/" version="1.1" method="POST"
contents="%%readafile:readrnd%%"></http>
     </request>

where readfafile is your own module that exports readrnd function. readrnd should return contents of random file. Note : filename would be a binary when read from file source, you may have to serialize.

instead of:

<request subst="true">
           <http url="/" version="1.1" method="POST"
contents_from_file="%%_file_name%%"></http>
     </request> 
Mahantesh
  • 79
  • 8