Home » Top 20 Cucumber Interview Questions for SDET – 2023

Top 20 Cucumber Interview Questions for SDET – 2023

1. What is Cucumber?

Cucumber is a tool used to run the functional tests which are based on Behavior Driven Development(BDD) methodology. The test cases are written in a plain English text. Cucumber is written in Ruby programming language.

2. What are the advantages of Cucumber?

The various advantages of Cucumber are as follows:

  • Tests are written in plain English text which allows the less technical people to write scenarios as well.
  • Product owners, business analysts, developers, and testers all are involved in writing test scenarios.
  • Code Reusability.

3. What is the language used by Cucumber?

Gherkin language is used in Cucumber tool.

It is a representation of the application behavior in simple English language.

4. What are the two files required to run a cucumber test?

The 2 files required to run a cucumber test are:

  • Feature file
  • Step Definition File

5. What is a Feature File?

A Feature file contains a high-level description of acceptance tests.
It is an entry point of Cucumber execution.
It contains either a scenario or multiple scenarios.
The tests in Feature file are written in Given-When-Then statements.

6. What is the file extension of feature file?

The extension of the feature file is .feature.
For eg: Test.feature

7. What does feature file consists of?

Feature file consists of parameters or conditions that are required to execute the code, they are:

  • Feature
  • Scenario
  • Scenario Outline
  • Given
  • When Then

8. What is Step-definition in Cucumber?

Step-definition in Cucumber defines the actual code implementation of the feature present in feature file.
Each step of the feature file is mapped to a corresponding method on Step definition file.

9. What is Scenario Outline in Feature file?

Scenario Outline is used when the same test scenario is executed for multiple sets of data.
It is always followed by the keyword “Examples” and this keyword specifies the set of values for each paramete

10. Explain different parameters of the feature file in Cucumber.

Feature: It describes the current test scripts that must be executed.

Scenario: It describes the steps and expected outcomes for a particular functionality.

Scenario Outline: It is used to execute same test scenario for multiple set of data.

Given: It specifies some context of the test to be executed.

When: It specifies some test action that needs to be carried out.

Then: It specifies the expected result of the test.

And: It is used for additional conditions, if any.

What is Automation?

11. What are the advantages of Cucumber framework?

Advantages of Cucumber framework are as follows:

  • It is an open-source tool.
  • It is written in plain English text, hence making it easier for non-technical users to understand.
  • It is easy to integrate it with other frameworks like Selenium.
  • The test cases are easier to understand and maintain as well.

12. What is Background keyword in Cucumber?

Background keyword is used to define a test case or series of steps which are common to all the tests in a feature file. Scenario keyword is replaced by Background keyword while writing the Cucumber test case in feature file.

13. What is the limit for the maximum number of scenarios that can be included in the feature file?

A feature file can have maximum of 10 scenarios, but this number can vary for different projects and different organization. However, it is advisable to limit the number of scenarios in feature file.

14. What is the use of Examples keyword in Cucumber?

Examples keyword is always used with Scenario Outline.
It is used to provide the value of the parameters used in the scenario.

15. Give an example of a feature file using Cucumber framework.

Below is an example of a feature file for scenario: “Login the web application”

Feature: Login into the web application with username and password

Scenario: Login the web application

Given: Open Chrome browser and enter the URL

When: UserName and Password is provided

Then: Validate if login is successful

16. Give an example of Step definition.

Below is the example of Step definition for Given statement :

@Given(Open Chrome browser and enter the URL.)

public void OpenChromeBrowser()


Driver = new ChromeDriver();

Driver.navigate.To(“https://devlabsalliance.com/”); }

17. What symbol is used for parametrization in Cucumber?

Pipe (|) is used for parametrization in Cucumber.
It allows to specify one or more parameter values in a feature file.

18. Cucumber is supported in which programming language?

Cucumber provides support for various programming language like Java, .Net, Ruby, etc.

19. What is dryRun option in Cucumber?

dryRun is used to verify that every step in the feature file have corresponding code in Step Definition or not.

So, in case if any function gets missed in the Step definition for any step of feature file, then dryRun will give a message.

Its value can be set either true or false.

20. What is monochrome option in Cucumber?

Monochrome option makes the console output for Cucumber test much more readable.

Its value can be wither true or false.

If it is set to false, then the console output is not as readable as it should be