-1

I am using selenium-cucumber framework in our project. So i have feature file in one package, stepdefinition class in one package and runner class in another package. I have some steps in Feature file as given below.

Feature: To test login of FreeCRM

Scenario Outline: login test
Given user in login page
When title of page is freeCRM
Then user enter <username>
Then user enter <password>
Then user click on login button
And user is in home page

Examples:
| username | password |
| test@gmail.io| test123@ |

So in this structure how can i do parameterization through json instead of giving data through example keyword in feature file.

Devleena
  • 453
  • 9
  • 25

1 Answers1

0

You can add qaf-cucumber dependency and it will enable you to use examples from external data providers like xml,json,csv,db,excel. Once you add dependency your scenario can use example form external file and may look like below:

@dataFile:resources/logindata.json
Feature: To test login of FreeCRM

Scenario Outline: login test
Given user in login page
When title of page is freeCRM
Then user enter <username>
Then user enter <password>
Then user click on login button
And user is in home page

Json data file:

[
    { "username" : "test@gmail.io" , "password":"123abc123" , "isvalid":false },
    { "username" : "Admin" , "password":"test" , "isvalid":false },
    { "username" : "admin" , "password":"Admin2193" , "isvalid":true }
]
user861594
  • 5,733
  • 3
  • 29
  • 45