My goal is to use Robot to take a list of login credentials and iterate through the list, logging into the page and essentially proving those users can see the page.
From what I've been finding, I need to use a Template, but I haven't found it very clear how do implement one when you have all the values you want to use in the same robot file.
I've been using https://github.com/robotframework/QuickStartGuide/blob/master/QuickStart.rst and http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#data-driven-style
Based on this example they have:
Templated test case
[Template] Example keyword
first argument second argument
They don't explicitly show an example of where the data is set up to run the test.
Here's what I have so far:
*** Settings ***
Documentation Test Access Levels of the new Page
Library Selenium2Library
Test Template Security Login Test
*** Test Cases ***
All Users Login Test
Security Login Test Login Test
User1 Pass1
User2 Pass2
User3 Pass3
*** Keywords ***
Enter User Name
input text working_username_field need_to_put_username_here
Enter Password
input text working_password_field need_corresponding_password_here
Click Login
click element working_login_button
Enter Store Number
input text working_store_field working_store_number
Click Search
click element working_search_button
Login Test
open browser working_url Chrome
enter user name
enter password
click login
enter store number
click search
go to working_sub_url
What I don't know is how I then put those parameters into my Keywords so it will go through each on.
I know I could use a file for this, but that seems slightly more complicated, so I want to figure this way out first.
Thanks for any help you can offer!
When you use a suite-level template, each testcase is typically a single row. The first column is the test case name, and additional columns are arguments to the template keyword.
For example:
*** Settings ***
Test Template Security Login Test
*** Test Cases ***
# test case name # username # password
Normal user [email protected] test123
Admin user [email protected] abc123
Banned user [email protected] knockknock
*** Keywords ***
Security Login Test
[Arguments] ${username} ${password}
Enter username ${username}
Enter Password ${password}
The rest of your code here...
Enter username
[Arguments] ${username}
log entering username '${username}
Enter password
[Arguments] ${password}
log entering password '${password}'
The rest of your code here...
log another keyword