Background:
- There are more than 500 users. Their user name and password are stored in a CSV file.
- Each user must pass this
.feature
file which consists of 18 scenarios.
Problem:
I know we can use data tables
, scenario outline
, but data mentioned here will be limited to associated scenarios only not for entire feature file.
I want once .feature
done executing first row of data it should go to next row from CSV file, and continue doing it until the end of CSV file.
I tried replacing Data table with MS Excel sheet, used (POI apache
files to read spreadsheet), but again same thing happened it ran for that particular scenario only.
E.g. This a .feature
file
@regression @userValidation
Feature: User permission validation
Scenario Outline: Verify that user is able to login
Given I am on login page
When I enter "username" and "password"
Then I see new user successfully loggedin
Examples:
| username |password| // picked from excel sheet
| uname |pwd | // picked from excel sheet
Scenario: Verify that user can change the password
Given I am on user profile page
When I enter change password twice
Then I get password successfully changed pop-up
Now, scenario one keep on running 500 times (number of rows in csv file) once all data is finished, it starts second scenario. What I want is it both scenario should run for row 1, then both scenario should for row 2 and so on for 500 times.
How can I do it? Is there a Java
or Junit
way to do it, if not possible in Cucumber?
I am using Java, Selenium WebDriver, JUnit, Cucumber, Maven on Windows