> is it possible to use a database table or an excel spreadsheet as a source for test data,
Yes. This is going to topic of next blog article!
You can try the example in v1.6.6 (released today),
Open demo project C:\Program Files\iTest2\samples\demo\demo.tpr
Select file database_spec.rb
The Excel file: C:\Program Files\iTest2\samples\demo\testdata
\users.xls (contains 3 username-password combinations)
The sample script tries login site:
travel.agileway.net with 3 pairs
of username/passwords and do assertion accordingly.
Test Scripts as below:
spec "Use Excel for data driven web tests" do
include RWebSpec::RSpecHelper
before(:all) do
open_browser("
http://travel.agileway.net")
# Load Excel file
excel_file = File.join(File.dirname(__FILE__), "testdata",
"users.xls")
excel_book = Spreadsheet.open excel_file
@excel_sheet1 = excel_book.worksheet "Users" # or use 0 for first
sheet
end
scenario "Load user list from an Excel spreadsheet to test multiple
user logins" do
# Iterate each row in the spreadsheet, use data for test scripts
@excel_sheet1.each_with_index do |row, idx|
next if idx == 0 # ignore first row
login, password, expected_text = row[1], row[2], row[3]
goto_page("/")
enter_text("userName", login)
enter_text("password", password)
click_button("Sign In")
page_text.should include(expected_text)
failsafe{ click_link("SIGN-OFF") } # if logged in OK, try log
out
end
end
end
Regards,
Zhimin
On Nov 2, 10:27 pm, chimeara <
gordon.leibbra...@ilabquality.com>
wrote: