
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Map Step Definition to Feature File in Cucumber
We can map a step definition file to a feature file in Cucumber. This can be done using the below steps −
Step1− Create a feature file with .feature extension(say Login.feature) with the following −
Feature − Login Module
Scenario − Welcome Page Login verification
Given User is on Welcome Page
Then Welcome page should be displayed
Step2− Create a step definition java file(say stepDefination.java) having the mapping of the step definition file to the feature file.
Example
package stepDefinations; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; public class stepDefination { @Given("^User is on Welcome Page$") public void user_on_welcome_page() { System.out.println("User on welcome page"); } @Then("^Welcome page should be displayed$") public void verify_user_on_welcome_page() { System.out.println("User should be on welcome page"); } }
Project Structure
Advertisements