How can I pass variables in cucumber background like we pass in our scenario.
We can group repetitive steps under a Background section in cucumber.
As per my scenario i have to login several times to test for diff templates; so i am keeping my login process in background but I don't want to hardcode it instead i want to put username and password in an excel sheet and then get it from there.
Ex:
Feature: UI Testing
Background: User log-in
Given I am on the login page
When I enter email "test00@ex.com"
When I enter password "tests123"
When I click on sign in button
Then I should see home page
Scenario: create template 1
When I Click on the templates-1
When I fill in the required details and click create
Then I validate template is created successfully
Then I should click sign out button
Scenario: create template 2
When I Click on the templates-2
When I fill in the required details and click create
Then I validate template is created successfully
Then I should click sign out button
Scenario: create template 2
When I Click on the templates-3
When I fill in the required details and click create
Then I validate template is created successfully
Then I should click sign out button
something like this:
Background: User log-in
Given I am on the home page
When I enter <email>
When I enter <password>
When I click on sign in button
Then I should see home page
Examples:
| email | password |
| A2 | C3 |
(A2 and C3 are cells of excel sheet)
How can I pass my email and password as parameter in background. Does it support Example, or data table to feed the excel sheet. or any other alternative. Can anybody give me pointer to achieve that.
Thanks in advance.