0% found this document useful (0 votes)
180 views

Cucumber

Cucumber is a behavior-driven development tool that allows automation of acceptance criteria in plain text. It uses a language called Gherkin to write feature files containing scenarios defined with keywords like Feature, Scenario, Given, When, Then. Two main files needed to execute Cucumber tests are feature files containing scenarios and step definition files mapping the steps to code. Benefits include involvement of non-technical stakeholders and priority on user experience over implementation.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
180 views

Cucumber

Cucumber is a behavior-driven development tool that allows automation of acceptance criteria in plain text. It uses a language called Gherkin to write feature files containing scenarios defined with keywords like Feature, Scenario, Given, When, Then. Two main files needed to execute Cucumber tests are feature files containing scenarios and step definition files mapping the steps to code. Benefits include involvement of non-technical stakeholders and priority on user experience over implementation.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

*http://learn-automation.

com/database-testing-using-selenium-webdriver/
http://learn-automation.com/integration-of-cucumber-with-selenium-webdriver/
https://www.youtube.com/watch?v=Vv7hHrVX_Zg&list=PL6flErFppaj1Ogn82-
OINRkPwoieZ2dEX&index=1
https://sukesh15.gitbooks.io/cucumber-jvm-test-framework-/content/test_framework_-
_driver_abstratction/driver_instance_-_with_hooks.html
http://www.seleniumframework.com/cucumber-jvm-3/data-driven-framework-with-excel/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
https://mindmajix.com/ruby-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


internally implemented in a Ruby programming language.
it focus on what to test not how to test
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.
profiles of cucumber:
cucumber features -p <profile_name>
How to generate cucumber execution reports ?

�format html �out report.html �format pretty

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


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


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
Benefits of cucumber in selenium:
-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.
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

You might also like