Search This Blog

StepDefinitions

Definitions.java
ü  This file acts like a bridge between the "Cucumber Test Steps" and "Java Code".
ü  In this file, we have to define the steps for "ALL" the test steps we used in the "demo.feature" file.
ü  To define, we use "Cucumber Annotations" with the cucumber steps.

This is how, the file looks like:
                @Given(<<Corresponding cuucmber step comes here>>)
                public void nameOfFunctionOne() throws Throwable {
                                // actual java code to complete the logic.
                                // Can call functions where the actual functionality is implemented
                }

                @Then(<<Corresponding cucumber step comes here>>)
                public void nameOfFunctionTwo() throws Throwable {
                                // actual java code to complete the logic.
                                // Can call functions where the actual functionality is implemented
                }

                @When(<<Corresponding cuucmber step comes here>>)
                public void nameOfFunctionThree() throws Throwable {
                                // actual java code to complete the logic.
                                // Can call functions where the actual functionality is implemented

                }

No comments:

Post a Comment