Saturday 28 April 2018

Gherkin: Feature keyword

Every ‘.feature’ file starts with ‘Feature’ keyword. A feature file is a collection of scenarios. ‘Feature’ section document the summary of the scenarios that we are going to test.

Syntax
Feature: Feature Title goes here
 Description of the Feature goes here. 
 It can span across multiple lines

A Feature keyword must be followed by either of the below keywords.
a.   Scenario
b.   Scenario Outline
c.   Background

Example

StudentPassStatus.feature
Feature: Student Pass status 

 Student pass status is decided based on below criteria.
 ---------------------------------------------------
  < 60  : second class
  >= 60 && < 70 : First class
  > 70 : Distinction
 ---------------------------------------------------
 
Scenario: Checking Second Class 
 Student will be notified as second class, if he got < Sixty percentage
  
 Given I am a student 
 When I got Fifty Five percentage of marks 
 Then I should be notified as Second Class 
 
Scenario: Checking First Class 
 Student will be notified as First class, if he got >= Sixty && < Seventy percentage
  
 Given I am a student 
 When I got greater than or equal to sixty and < seventy percentage of marks 
 Then I should be notified as First Class 
 
Scenario: Checking Destinction 
 Student will be notified as Distinction if he got > Seventy percentage
  
 Given I am a student 
 When I got greate than seventy percentage of marks 
 Then I should be notified as Distinction

Previous                                                 Next                                                 Home

No comments:

Post a Comment