In this post we will learn about writing multiple test cases (Scenarios) in a Feature file. This post is going to be an extension to the previous post First Test Case in Selenium with Cucumber. So please go through it to understand the current post better. Let's get started step by step...
Step 1: This time we are taking "Gmail valid login validation" as our test. Please copy the below code snippet in our feature file created "gmailLogin.feature" file and save it.
Step 2: Now go to TestRunner.java Right click > Run As > Junit Test
Step 1: This time we are taking "Gmail valid login validation" as our test. Please copy the below code snippet in our feature file created "gmailLogin.feature" file and save it.
Step 2: Now go to TestRunner.java Right click > Run As > Junit Test
Step 3: Check out the Junit results, The first scenario is executed and passed but the second scenario is stopped at the 3rd step in the second scenario and failed. This because the last three steps are missing in the Step Definitions.
In the console we will find the three missed steps, add the three in step definitions file and define their functionalities.
Step 4: Add the steps in Step Definition file and define their actions.
Step 5: Go to TestRunner.java Right click > Run As > Junit Test.
Step 6: Check out the Junit results now, two scenarios are executed successfully and are Passed also.
This is how we can add multiple tests in the feature file. And we need not execute all the scenarios for adding a new scenario. Comment all the previous scenarios > add the new scenario and run it as Junit test > add missed step definitions. That's how we can add the multiple scenarios.
thanks,this is good link
ReplyDeleteThank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
ReplyDeleteSelenium certification training
Individuals will become a skilled writer only writing and writing some more. Further, writing is not a linear process. It is messy and frequently, time consuming.resume template
ReplyDeleteGreat job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. type my essay
ReplyDeletePretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. essay writing services
ReplyDeleteWhoa! I’m enjoying the template/theme of this website. It’s simple, yet effective.
ReplyDeleteSelenium Training in chennai | Selenium Training in anna nagar | Selenium Training in omr | Selenium Training in porur | Selenium Training in tambaram | Selenium Training in velachery
Crystal clear explanation.Eagerly waiting for future updates.
ReplyDeleteJava training in Chennai
Java training in Bangalore
Java training in Hyderabad
Java Training in Coimbatore
Java Online Training
I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts.
ReplyDeletePython Training in Chennai
Python Training in Training
Python Training in Bangalore
Python Hyderabad
Python Training in Coimbatore
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon.
ReplyDeleteSoftware Testing Services
Software Testing Services in USA
Software Testing Companies in USA
Software Testing Company
QA Testing Services
QA Software Testing Services
QA Testing Companies in USA
Functional Testing Services
Test Automation Services
Functional Testing Company
Performance Testing Services