I've got some simple thread code, included below, which will attempt to process 
every file it finds in a particular directory in a new thread within my 
application under test.  This is essentially some very light load testing.

(Obviously I've left a lot of the code out, but there's enough to get the idea 
below.)

Unfortunately, this only appears to function for 1, or if I'm lucky, 2, files.  
Essentially the first thread will set the file_field, but each subsequent 
thread (if attempting to input the file_field at roughly the same time) will 
fail to input the 'inputfile'.  It opens the standard Windows find file dialog, 
but won't select the file.

It simply hangs, as though it doesn't know which one to select (even though the 
inputfile variable is still valid at this stage), or fails to select it.

 def asset_transform(inputfile)
 # lots of other stuff regarding browsing the aut included in here
      ie.file_field(:id,'item_file').set(inputfile)
 end

 source_dir=File.dirname(__FILE__) + '/files_to_upload/'
 threads = []
 (Dir[source_dir+"*.*"]).each do |each_file|
   each_file.gsub!('/','\\')
     threads << Thread.new {asset_transform(each_file)}
 end
 threads.each {|x| x.join}

What could be behind this?  Is it a problem with threads and the find file 
dialog box?  Are threads not the best way to approach something like this?  Do 
I need to be smarter with my threads, in a way I don't know?  Is there a better 
method for the 'load' testing I'm attempting?

- J
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to