Ruby Cucumber Interview Questions

What is Cucumber?

Cucumber is a Behavior Driven Development (BDD) tool. Cucumber is a tool that executes plain-text functional descriptions as automated tests. The language that Cucumber understands is called Gherkin.

What is profile in cucumber ?

We can create Cucumber profiles to run specific features and step definitions.We can use following command to execute a cucumber profile

cucumber features -p <profile_name>

Ex: cucumber features -p regression

What are the advantages of Cucumber?

-You can involve business stakeholders who can not code

-End user experience is priority

-High code reuse

What is cucumber.yml file in cucumber ?

in cucumber.yml file we will create profiles

What is cucumber dry run ?

Cucumber dry run is used to compile cucumber feature files and step Definitions. If there is any compilations errors it will show when we use dry run

Ex: Cucumber features –dry-run

What is scenario outline ?

Scenario outline is used to execute the same scenario with different test data.

we will add test data in examples section

What are the keywords that we use in cucumber scenario steps ?

We use Given,when,Then,And and But keywords in cucumber scenario steps

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

The 2 files required to execute a Cucumber test scenario are


-Step Definition

What is ORM in Rails?

ORM tends for Object-Relationship-Model, it means that your Classes are mapped to table in the database, and Objects are directly mapped to the rows in the table.

How to generate cucumber execution reports ?

–format html –out report.html –format pretty

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



-Scenario Outline




Watir Webdriver: wait_until_present

browser.button(:id => “send”)    # default timeout of 30 seconds

browser.button(:id => “send”).when_present(2).click # time out after 2 seconds 

browser.div(:id => “container”).when_present { |div| }

browser.div(:id => “foo”).present? # returns true if element exists and is visible

browser.div(:id => “loading”  ).wait_while_present

browser.div(:id => “container”).wait_until_present

Watir::Wait.until { ...arbitrary predicate... }

Watir::Wait.while { ...arbitrary predicate... }

How to run a particular scenario from a feature file ?

We can run particular scenario from a feature file by giving the scenario line number

Ex: cucumber features/test.feature:21

Learn more about Ruby Cucumber Interview Questions in this blog post.

Why Ruby on Rails?

There are lot of advantages of using Ruby on Rails(ROR)

-DRY Principal

Convention over Configuration

-Gems and Plugins


-Pure OOP Concept

What are the difference between Jbehave and Cucumber?

Although Cucumber and Jbehave are meant for the same purpose, acceptance tests are completely different frameworks

-Jbehave is Java based and Cucumber is Ruby based

-Jbehave are based on stories while Cucumber is based on features

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 when to use Rspec and when to use Cucumber?

-Rspec is used for Unit Testing.

-Cucumber is used behaviour driven development. Cucumber can be used for System and Integration Tests.

What is the language used for expressing scenario in feature file ?

Gherkin language is used to express scenario in feature files and ruby files containing unobtrusive automation for the steps in scenarios

Explain what is regular expressions?

A regular expression is a pattern describing a certain amount of text.  The most basic regular expression consists of a single literal character

What is BDD Framework.what is the benefit of BDD in selenium?

-BDD is becoming widely accepted practice in agile software development, and Cucumber-JVM is a mainstream tool used to implement this practice in Java. Cucumber-JVM is based on Cucumber framework, widely used in Ruby on Rails world as well as in Java and .Net.

-Cucumber-JVM allows developers, QA, and non-technical or business participants to write features and scenarios in a plain text file using Gherkin language with minimal restrictions about grammar in a typical Given, When, and Then structure.

-The feature file is then supported by a step definition file, which implements automated steps to execute the scenarios written in a feature file. Apart from testing APIs with Cucumber-JVM, we can also test UI level tests by combining Selenium WebDriver.

-For more information on BDD framework with selenium and cucumber visit here.

What software do you need to run a Cucumber Web Test ?

-Ruby and its Development Kit


-IDE like ActiveState

-Watir ( To simulate browser)

-Ansicon and rspec (if required)


“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at, we will update the article in 24 hours.”

3 Responses on Ruby Cucumber Interview Questions"

  1. Kishore Sukhabogi says:

    This is awesome for starters

  2. Malini SM says:

    Its really beneficial for beginners. Please post interview questions for more than 2 years experienced person in Cucumber – Ruby.
    Thank you

Leave a Message

Your email address will not be published. Required fields are marked *


Please leave a message and we'll get back to you soon.

3 + 5