I would have combined writing feature file, writing step definitions and writing runner class in single post but it will become lengthy and may look like a complex process. So to make it simple i wrote three separate posts. Lets switch to runner class.
We have written Scenario, Steps and Step definitions. We can execute tests without test runner class also. In the previous post we have mapped (glued) Steps in feature file and Step definitions in the IntelliJ Edit Configuration. Now run the feature file 'gmailLoginFeature.feature'
You should see execution start, browser launch, application navigation and etc. But the advantage of using test runner class is you can configure reports, can add plugins, can change test behavior and etc.
Cucumber uses Junit runner class to execute the tests. In the runner class mainly we need specify two things:
We have written Scenario, Steps and Step definitions. We can execute tests without test runner class also. In the previous post we have mapped (glued) Steps in feature file and Step definitions in the IntelliJ Edit Configuration. Now run the feature file 'gmailLoginFeature.feature'
You should see execution start, browser launch, application navigation and etc. But the advantage of using test runner class is you can configure reports, can add plugins, can change test behavior and etc.
Cucumber uses Junit runner class to execute the tests. In the runner class mainly we need specify two things:
- @RunWith: This annotation tells Junit to run the tests as Cucumber tests
- @CucumberOptions: Cucumber options is used to specify the features to executed, step definitions location, plugins, and etc.
Step 1: Create 'testRunnerPackage' and create a 'testRunnerClass' class in it. You can give any name.
Step 2: Add @RunWith(Cucumber.class) annotation above the class
feature: To specify the feature files to be executed
glue: Glue means sticking together. It is used to specify the location of the Step Definitions file.
Step 4: Execute the steps using test runner class and checkout the below video (please view in Full Screen)
Finally we completed our first cucumber test execution. Please share your feedback on this.
Thanks for reading!! #seleniumbabu #HappyLearning
Step 4: Execute the steps using test runner class and checkout the below video (please view in Full Screen)
Finally we completed our first cucumber test execution. Please share your feedback on this.
Thanks for reading!! #seleniumbabu #HappyLearning
This is one awesome blog article. Much thanks again. selenium Online course Bangalore
ReplyDeleteThanks likitha, Keep Visiting :)
DeleteExcellent post on selenium related Read Selenium interview questions with answers scenario based and Get selenium online training by the most experienced and expertise trainer in india.
ReplyDeleteSuch great information for blogger iam a professional blogger thanks…
ReplyDeleteLooking for Hadoop Admin Training in Bangalore, learn from Softgen Infotech provide Hadoop Admin Training on online training and classroom training. Join today!