top button

What is feature file in Cucumber? What does feature file consist of ?

0 votes
7 views
posted Mar 10 by Sheetal Gawade

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

A Feature File is an entry point to the Cucumber tests. This is a file where you will describe your tests in Descriptive language (Like English). It is an essential part of Cucumber, as it serves as an automation test script as well as live documents. 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. Let’s create one such file.

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

Cucumber Feature 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.

First_Cucumber_Test_7

Note: In case you get a pop up from Eclipse which suggest you to install the better Editor for BDD files, please go ahead and install that. At the botttom of the chapter, steps to install the better editor is given.

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

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

answer Mar 14 by Arunkumaarts
Similar Questions
...