Re: Parameterizing using TestWise

17 views
Skip to first unread message

bruce.posey

unread,
Jan 16, 2012, 12:33:08 PM1/16/12
to test...@googlegroups.com
Hi I am using test wise but not Selenium, Watir instead but I do have functional scripts that read from excel spread sheets and get user Id and Passwords and use it to populate our application with them.  Id be happy to send them to you if you think it will help.
 
 
I use a *test.rb file as teh test scripts along with *page.rb files that do most of the gui interaction.
Do supply your personal email address though.
 
Bruce Posey

On Mon, Jan 16, 2012 at 10:26 AM, LearnTestWise <getsta...@gmail.com> wrote:
I am trying to build a script with TestWise IDE. When creating project
I have selected 'Selenium Webdriver' as my web automation driver and
test script syntax to be 'rspec'. I am trying to login to application
with different user ids. I am trying to pass various userids and
password combinations through an external file. When I run the script
the application is not taking any values from excel and hence login
fails. Any help in this regards will be appreciated.

My test script:

before(:all) do
   # Identify browser and url to test on.
   @browser = Selenium::WebDriver.for :ie
   @browser.navigate.to "URL"

   # Load excel spreadsheet
   excel_file = File.join(File.dirname(__FILE__), "TestData",
"InputData.xls")
   excel_book = Spreadsheet.open excel_file
   @excel_sheet1 = excel_book.worksheet "Login" # or use 0 for first
sheet
 end

 after(:all) do
   @browser.quit unless debugging?
   excel_file = File.join(File.dirname(__FILE__), "TestData",
"InputData.xls")
   excel_book = Spreadsheet.close excel_file
 end

 it "Data Through Excel" do
   @excel_sheet1.each_with_index do |row, idx|
   next if idx == 0 # ignore first row
   USERID, PASSWORD = row[1], row[2]
   @browser.find_element(:id, "user_id").send_keys @USERID
   @browser.find_element(:id, "password").send_keys @PASSWORD
   @browser.find_element(:xpath,"//input[@value='Login']").click
   @browser.find_element(:link_text, "logout").click
   end
 end
end

Reply all
Reply to author
Forward
0 new messages