Hello cmcmahon,

When I read your query, I thought of a very very primitive method to perform 
your task.  Though I firmly believe that you would want a far more elegant 
method to deal with your problem, just out of an anxiety, I am giving the 
method in the form of the script below:

require 'Watir'
include Watir
input_excel_file = 'C:\trials\percentages.xls'
# This input excel file will contain values for the number of iterations to be 
run along with the percentage of times the methods, a, b and c, needs to be 
called
# The simple form of this sheet can contain 2 rows of data with headers (number 
of iterations, percentage of method a, percentage of method b and percentage of 
method c) in the first row 
# The second row will contain the values for these headers.
excel = WIN32OLE::new('excel.Application')
workbook = excel.Workbooks.open(input_excel_file)
worksheet = workbook.Worksheets(1)
worksheet.Select
number_of_iterations = worksheet.cells(2,1)['Value']
a_percentage = worksheet.cells(2,2)['Value']
b_percentage = worksheet.cells(2,3)['Value']
c_percentage = worksheet.cells(2,4)['Value']
a_value = int(a_percentage * number_of_iterations/100)
b_value = int(b_percentage * number_of_iterations/100)
c_value = int(c_percentage * number_of_iterations/100)
for i in 1..a_value
        a
end
for i in 1..b_value
        b
end
for i in 1..c_value
        c
end

Thanks for your time,
Vijay
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6528&messageID=18873#18873
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to