Hi,
I want to iterate the given below feature file n times(it must execute
number of times i mentioned). Here i have got all the datas from the excel
and stored it in an array using that array im filling the credentials and
for each iteration it must take the value from the next row.
Can you please help me how to do it.....
Thanks and Regards,
Akshaya
test.feature
--------------
Feature: Sample test
Scenario: Login page
Given I am a user
When I enter my username
And I enter my password
And I Click submit button
Then It will navigate next page
test.rb
---------
require "cucumber"
require "watir_webdriver"
require "win32ole"
require 'c:\Users\Desktop\test\testData.rb'
Given /^I am a user$/ do
@browser=Watir::Browser.new:ie
@browser.goto("http://www.gmail.com")
end
Testing=ruby.new
userName1=Array.new(5)
userName1=Testing.userName()
password1=Testing.password()
When /^I entered my username$/do
@browser.text_field(:id,"username").set(userName[i])
end
And /^I enter my password$/
@browser.text_field(:id,"password").set(password[i])
end
And /^I Click submit button$/do
@browser.button(:id,"submit").click
end
Then /^It will navigate next page$/ do
@browser.goto("https://www.google.com") #the required url should be given
end
testData.rb:
------------
Class ruby
def Excel()
X1=Win32OLE.new("Excel.Application")
@sht=X1.workbooks.open('c:\Users\Desktop\test\data.xls')
@[email protected](1)
@row=2
end
def userName()
Excel()
userName=Array.new(5)
i=0
loop do
if(@wrksheet.Range("a#{@row}").value)!=nil then
userName[i][email protected]("a#{@row}").value
@row+=1
i+=1
else
break
end
end
@sht.close
return userName
end
--
--
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]
---
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.