BDD with cucumber-Java Part-2

Create a folder 'features' and then in the folder
Create a file with extension '.feature'
Enter the english set of lines (Gherkin). For more details click the image

https://cucumber.io/docs/reference

Now inside 'myCucumber' package create a TestRunner class. This class wil act as starting pt for JUnit tests. This class is annotated with TheRunWith annotation.When a class is annotated with @RunWith or extends a class annotated with @RunWith, JUnit will invoke the class it references to run the tests in that class instead of the runner built into JUnit. Cucumber Options enable you to specify path to feature files/step definitions/reports etc..
Now inside 'myCucumber' package create a package named stepDefinitions. Within this create StepsSet01 class. This contains the glue code in java for the gherkin steps.
Now go to TestRunner class and Run As> JUnit test
Output:

Continued here

Comments

Popular Posts