I want to have username and pwd set in variable file and as the test steps through each username, it advances to the next row of data.
I am using resource files to drive the data, and my initial FOR script processes username 1 (eeny), then the nested FOR loop passes all of the passwords at once.
*** Variables ***
@{users} eeny meeny miny moe
@{pwds} pwd pwd1 pwd2 pwd3
*** Test Cases ***
Login Test
:FOR ${u} IN @{users}
\ Open Browser ${URL}
\ set window size 1440 900
\ set selenium speed .5
\ input text id=username ${u}
\ :FOR ${p} IN @{pwds}
\ \ input text id=password ${p}
\ \ click button css=button.primary
\ \ wait until page contains css=p.logout
\ \ capture page screenshot
\ \ click element css=p.logout
Currently I am trying for a nested FOR statement, or a FOR statement that declares both username and password variables in the same time, but am not opposed to changing tactics for getting the data and using a multi dimensional array or similar if that worked better.
Data Driven testing can be achieved through 'Data Driven through Test Template' or Read data from Excel or csv.
'Data Driven through Test Template'
In this we will create a user defined keyword which is nothing but the function or source code which we want to execute for multiple times. that we declare as
'Test Template'
inSettings
section.when we give the TestCase name with arguments , it will execute
Test Template
each time.here the sample code
'Data driven by read from Excel'
Read the values from Excel sheet and run multiple times,
here the sample code