Computer >> Computer tutorials >  >> Programming >> Java

How to create a step definition file for Cucumber in Java?


We can create a step definition file for Cucumber. This can be done using the below steps −

Step1− Click on the File menu in Eclipse. Then select the option New. Next click on Other

How to create a step definition file for Cucumber in Java?

Step2− Click on Maven Project from the Maven folder. Then click on Next.

How to create a step definition file for Cucumber in Java?

Step3− Proceed with the further steps.

Step4− Select maven-achetype-quickstart template. Then click on Next.

How to create a step definition file for Cucumber in Java?

Step5− Add GroupId as Automation, Artifact Id as Cucumber, and proceed.

Step6− A project should get created with a Cucumber-type project structure. The Cucumber-related scripts should be written within the src/test/java folder.

How to create a step definition file for Cucumber in Java?

Step7− Create a new package called stepDefinations inside the src/test/java folder.

How to create a step definition file for Cucumber in Java?

Step8− Create a Java class file within the stepDefinations package. Right-click the stepDefinations package, then select option New->Class.

How to create a step definition file for Cucumber in Java?

Step9− Give a Java class file name, say stepDefination, then click on Finish.

How to create a step definition file for Cucumber in Java?