Cucumber Features File
Estimated reading time: 4 minutes
- For the best performance, please clean up the Katalon workspace frequently. Navigate to File > Clean up.
Features File is located within 'Include/'features' folder from your project folder and can be seen from Tests Explorer:
The content of Features File will follow BDD conventions (_Given, When, The_n). When creating a new Features File, there will be an option to 'Generate sample Feature template' which will generate a sample template for your Features File. This will ensure that the created Features File matches with BDD convention so that you will reduce efforts in creating Features File in the correct format.
Let's look at an example of Katalon Demo Cura System (http://demoaut.katalon.com). We want to test the Login feature with a valid and invalid credential so the content will be something like this:
Tags are a great way to organize Features and Scenarios. Read more...
Sample Features File
#Author: email@example.com #Keywords Summary : #Feature: List of scenarios. #Scenario: Business rule through list of steps with arguments. #Given: Some precondition step #When: Some key actions #Then: To observe outcomes or validation #And,But: To enumerate more Given,When,Then steps #Scenario Outline: List of steps for data-driven as an Examples and <placeholder> #Examples: Container for s table #Background: List of steps run before each of the scenarios #""" (Doc Strings) #| (Data Tables) #@ (Tags/Labels):To group Scenarios #<> (placeholder) #"" ## (Comments) #Sample Feature Definition Template @Login Feature: Login Feature As a user, I want to login to Cura System so that I can make an appointment. @Valid Scenario Outline: Login with a valid credential Given I navigate to Cura System homepage When I click Make Appointment button And I enter username <username> and password <password> And I click Log in button Then I should be able to login successfully Examples: | username | password | | John Doe | ThisIsNotAPassword | @InValid Scenario Outline: Login with an invalid credential Given I navigate to Cura System homepage When I click Make Appointment button And I enter an invalid username <username> and password <password> And I click Log in button Then I should NOT be able to login successfully Examples: | username | password | | Jane Doe | ThisIsNotAPassword |
Maintain Features File
- Katalon Studio code inspection will detect and highlight any missing Step Definitions in Features File to help the user create the required step definitions.
There will be cases the current Features File meet one of the following maintenance difficulties:
- The current format is not organized properly.
- Figure out which Step Definitions is mapped with current Gherkin step.
- Recalculate steps in the Features file when there are changes in Step Definitions.
Above difficulties have been handled directly from the context menu of Feature File editor.
|Pretty Format||Re-do the format.|
|Find Step||Find relevant step of current Gherkin step in existing Step Definitions files.|
|Recalculate steps||Recalculate steps in the Feature file when there are changes in Step Definitions.|