How to write a feature file in Cucumber

0 votes
How can I write a Feature file in Cucumber?
Aug 1, 2019 in Selenium by Parminder
2,107 views

1 answer to this question.

0 votes

Feature File is an entry point to the Cucumber tests. This is a file where you will describe your tests in Descriptive language.

A feature file can contain a scenario or can contain many scenarios in a single feature file but it usually contains a list of scenarios.

here's how you can create such a file:

1) On the Feature folder Right click and select New > File

2) In order for Cucumber to automatically detect the stories (or features, as they’re known in Cucumber), you need to make sure that they carry the ‘.feature‘ file extension. For example, in this case, I’ve named my user story ‘LogIn_Test.feature‘. Every ‘.feature‘ file conventionally consists of a single feature.

3) Write the first cucumber script. In BDD terms the scenario would look like the following.

Cucumber Test Script

Feature: Login Action
Scenario: Successful Login with Valid Credentials
Given User is on Home Page
When User Navigate to LogIn Page
And User enters UserName and Password
Then Message displayed Login Successfully
Scenario: Successful LogOut
When User LogOut from the Application
Then Message displayed LogOut Successfully

Note: This is a simple test in Cucumber.

answered Nov 27, 2019 by Sirajul
• 59,230 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to write a test case in Selenium IDE?

Hey Sam, to write a test case ...READ MORE

answered May 14, 2019 in Selenium by Pratibha
• 3,690 points
2,841 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,674 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,143 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,875 views
+3 votes
1 answer

How to read excel file numeric data of all rows and column in selenium? I have 10 rows and 5 column but I read Only String value not a Numeric value?

Hey, @Mahendra, check this thread https://www.edureka.co/community/52170/read-numeric-data-from-excel-sheet-using-selenium-webdriver It deals with ...READ MORE

answered Jan 27, 2020 in Selenium by Sirajul
• 59,230 points
2,101 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP