Following are frequently asked Cucumber Testing Interview Questions for freshers as well as experienced QA professionals.
1) What is Cucumber? 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 are:
- You can involve business stakeholders who cannot code
- End-user experience is a priority
- High code reuse
2) What are the two files required to execute a Cucumber test scenario?
Two files required to execute a Cucumber test scenario are
- Step Definition
3) explain the use of Background keyword in Cucumber?
Background keyword is used to group multiple given statements into a single group. The keyword mostly used when the same set of given statements are repeated in each scenario of the feature file.
4) Give an example of a behavior is driven test in plain text?
- Feature: Visit XYZ page in abc.com
- Scenario: Visit abc.com
- Given: I am on abc.com
- When: I click on XYZ page
- Then: I should see ABC page
5) What is Scenario Outline in feature file?
Scenario Outline is the same scenario can be executed for multiple sets of data using the scenario outline. The data is provided by a tabular structure separated by (I I).
6) Explain the term step definition in Cucumber
A step definition is the actual code implementation of the feature mentioned in the feature file.
7) Give an example for step definition using “Given” function?
For example to make visitor visit the site “Yahoo” the command we use for given
Given (/^ I am on www.yahoo.com$/) do
end – This will visit www.yahoo.com
8) What are the differences between Jbehave and Cucumber?
Although Cucumber and Jbehave are meant for the same purpose, acceptance tests are completely different frameworks
- Jbehave is, and Cucumber is Ruby-based
- Jbehave are based on stories while Cucumber is based on features
9) Explain 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
10) When to use Rspec and when to use Cucumber?
- Rspec is used for Unit Testing
- Cucumber is used for Behavior-driven development. Cucumber can be used for System and Integration Tests
11) 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 testing for the steps in scenarios
12) What are 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.
13) What is BDD?
BDD or Behavior-driven development is a process of developing software based on TDD (Test Driven Development) which focusses on the behavioral specification of software testing units.
14) What software do you need to run a Cucumber Web Test cases?
- Ruby and its Development Kit
- IDE like ActiveState
- Watir ( To simulate browser)
- Ansicon and rspec (if required)
15) What does a cucumber features/ support file contain?
Features/ support file contains supporting ruby code. Files in support load before those in step_definitions, which can be useful for environment configuration.
16) What is a Feature file?
Features file contain a high-level description of the Test Scenario in simple language. It is known as Gherkin which is a plain English text language. Feature File consists of the following components like:
- Feature: It describes the current test script which has to be executed.
- Scenario: It is steps and expected outcome for a specific test case.
- Scenario outline: Scenario can be executed for multiple sets of data using scenario outline.
- Given: It specifies the context of the text to be executed.
- When: specifies the test action which has to perform.
- Then: Expected outcome of the test can be represented by “Then”
17) What is Selenium?
Selenium is an automation tool which is a widely used tool for Functional Testing of the web-based application. Selenium supports different language like ruby, java, python C#, etc.
18) Why use Cucumber with Selenium?
Cucumber and Selenium are two popular technologies. Many organizations use Selenium for functional testing. These organizations which are using Selenium want to integrate Cucumber with Selenium as Cucumber helps you to read and to understand the application flow.
19) Advantages of Cucumber
Here, are some prominent advantages of using Cucumber.
- It is helpful to involve business stakeholders who can’t easily read the code
- Cucumber Testing enhances the end-user experience
- Style of writing tests allow for easier reuse of code in the tests
- Allows quick and easy setup and execution
20) What is a Step Definition?
Step definition maps the Test Case Steps in the feature files to code. It executes the steps on Application Under Test and checks the outcomes against expected results. In order to execute step definition it must match the given component in a feature.