I'm looking for a way to use yaml files to load test data whose values will 
be put directly into a lead post url.  The hash example using "URI.parse" 
along with "Net::HTTP.post_form(uri....." below works well for me, but it 
will be tedious to create hundreds of similar ruby scripts.  This example 
is the shortest form, and others require several more key => values.  

Is it possible to save all of my keys and values in a yaml file, and then 
load that data into my lead post url using this general script?  I colored 
the bit of code in green that I'm trying to improve.  The rest of it is 
capturing the leadid which I use to verify in the database using 
TinyTds::Client.  I mention this because I'm less concerned with filling 
out the actual web form that I am with testing how our lead processing 
engine handles different scenarios.  Thanks for reading.


require "rubygems";
require "watir-webdriver"
require "net/http"
require "uri"
require "tiny_tds"

uri = URI.parse("http://SomeCompany.com/leadpost";)

#Read in the yaml

#call lead and save response

response = Net::HTTP.post_form(uri, {"leadsourceid" => "2555", "link_id" => 
"55555", "pin" => "55555555",
  "nextstepid" => "2", "first_name" => "Dan", "last_name" => "Danlastname", 
"email" => "[email protected]"})

puts response, "\n"

substring = "leadid>"
responsestring = response.body
start_ss = responsestring.index(substring)+7
newlead = responsestring[start_ss,8]
print newlead, "\n"

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to