Top 10 Cucumber Interview Questions


What is Cucumber and what are the advantages of Cucumber?

To run functional tests written in a plain text Cucumber tool is used. It is written in a Ruby programming language. Advantages of Cucumber
  1. 1- You can inolve business stakeholders who can not code
  2. 2- End user experience is priority.
  3. 3- High code reuse.

What are the 2 files required to execute a Cucumber test scenario?

The 2 files required to execute a Cucumber test scenario are
  1. 1- Features
  2. 2- Step Definition.

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

Feature file in cucumber consist of parameters or conditions required for executing code, they are:

  1. a) Feature.
  2. b) Scenario.
  3. a) Scenario Outline.
  4. b) Given.
  5. c) When.
  6. d) Then.

What is step definition in Cucumber?

A step definition is the actual code implementation of the feature mentioned in feature file.

Explain what is BDD (Behaviour Driven Development)?

BDD or Behaviour driven development is a process of developing software based on TDD (Test Driven Development) which focusses on behavioural specification of software units.

What are before, after, beforeStep and afterStep hooks?

  • 1- Before: executes before the feature file execution.
  • 2- After: executes after the feature file execution.
  • 3- BeforeStep: executes before the each step execution.
  • 4- AfterStep: executes after the each step execution.

What are cucumber tags? And why do we use them?

Cucumber tags help in filtering the scenarios. We can tag the scenarios and then run them based on tags.

1- We can add tags to scenarios with <@> symbol.

Explain what is test harness?

A test harness for cucumber and rspec allows for separating responsibility between setting up the context and interacting with the browser and cleaning up the step definition files.

Explain what is Scenario Outline in feature file?

Scenario Outline: Same scenario can be executed for multiple sets of data using scenario outline. The data is provided by a tabular structure separated by (I I).

What is the purpose of cucumber dry-run?

We use to compile the cucumber feature files and step definitions. If there occur any compilation errors, then it shows them on the console.

selenium testing