HR Asked Cucumber Interview Questions
1) 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
You can inolve business stakeholders who can not code
End user experience is priority
High code reuse
2) What are the 2 files required to execute a Cucumber test scenario?
The 2 files required to execute a Cucumber test scenario are
Features
Step Definition
3) 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
Feature
Scenario
Scenario Outline
Given
When
Then
4) Give an example of behaviour 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) 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).
6) What is step definition in Cucumber?
A step definition is the actual code implementation of the feature mentioned in feature file.
7) Give the 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
Browser.goto “http://www.yahoo.com”
end – This will visit www.yahoo.com
8) 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
9) 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
10) 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
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 for the steps in scenarios
12) 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
13) 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.
14) What softare do you need to run a Cucumber Web Test ?
Ruby and its Development Kit
Cucumber
IDE like ActiveState
Watir ( To simulate browser)
Ansicon and rspec (if required)
15) What does a features/ support file contains?
Features/ support file contains supporting ruby code. Files in support load before those in step_definitions, which can be useful for environment configuration.