Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Cucumber Execution Starts From Where ?

Answer»

Cucumber execution will starts from SUPPORT. In support first it will LOAD the env.rb file then it will load hooks.rb and then it will START execute FEATURE file scenario STEPS.

Cucumber execution will starts from support. In support first it will load the env.rb file then it will load hooks.rb and then it will start execute feature file scenario steps.

2.

Define What Is Profile In Cucumber ?

Answer»

<P>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

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

3.

Define What Are Before, After, Beforestep And Afterstep Hooks?

Answer»
  • Before:EXECUTE before the FEATURE FILE execution
  • After:executes after the feature file execution
  • BEFORESTEP:executes before the each STEP execution
  • AfterStep:executes after the each step execution

4.

Define What Is Cucumber Dry Run ?

Answer»

Cucumber DRY RUN is used to COMPILE cucumber feature FILES and step Definitions. Of there is any COMPILATIONS errors it will Define How when we use dry run 

Ex: Cucumber features –dry-run

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

Ex: Cucumber features –dry-run

5.

How To Run A Particular Scenario From A Feature File?

Answer»

We can RUN particular scenario from a FEATURE FILE by giving the scenario line NUMBER

Ex: cucumber features/test.feature:21

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

Ex: cucumber features/test.feature:21

6.

Define What Is Scenario Outline ?

Answer»

SCENARIO OUTLINE is used to execute the same scenario with DIFFERENT test data.

we will ADD test data in EXAMPLES section

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

we will add test data in examples section

7.

Define What Are The Keywords That We Use In Cucumber Scenario Steps ?

Answer»

We use GIVEN,when,Then,And and But KEYWORDS in cucumber scenario STEPS .

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

8.

Define How To Generate Cucumber Execution Reports ?

Answer»

We can USE the following COMMAND to GENERATE html reports.

–format html –out report.html –format pretty

We can use the following command to generate html reports.

–format html –out report.html –format pretty

9.

Define What Is Cucumber And Define What Are The Advantages Of Cucumber?

Answer»

To run functional tests written in a plain text Cucumber TOOL is used. It is written in a Ruby programming language.

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

10.

Explain Define What Is Scenario Outline In Feature File?

Answer»

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).

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).

11.

Define What Is Step Definition In Cucumber?

Answer»

A step DEFINITION is the actual CODE implementation of the FEATURE mentioned in feature file.

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

12.

Define What Are The Difference Between Jbehave And Cucumber?

Answer»

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

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

13.

Explain Define What Is Test Harness?

Answer»

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

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

14.

Define What Is The Language Used For Expressing Scenario In Feature File ?

Answer»

Gherkin LANGUAGE is used to EXPRESS scenario in FEATURE files and RUBY files containing unobtrusive automation for the steps in SCENARIOS

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

15.

Explain Define What Is Regular Expressions?

Answer»

A regular expression is a pattern describing a CERTAIN amount of text. The most basic regular expression consists of a SINGLE LITERAL CHARACTER.

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

16.

Define What Does A Features/ Support File Contains?

Answer»

Features/ support file CONTAINS supporting ruby code. Files in support LOAD before those in step_definitions, which can be useful for environment CONFIGURATION.

Features/ support file contains supporting ruby code. Files in support load before those in step_definitions, which can be useful for environment configuration.

17.

Define What Software Do You Need To Run A Cucumber Web Test ?

Answer»
  • RUBY and its Development KIT
  • Cucumber
  • IDE LIKE ActiveState
  • Watir ( To SIMULATE browser)
  • Ansicon and rspec (if required)

18.

Define What Is Bdd Framework.define What Is The Benefit Of Bdd In Selenium ?

Answer»

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.

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.

19.

Define What Is Error Handling And Define How Do You Do Error Handling?

Answer»

P584: RAISE, RESCUE

P584: Raise, Rescue

20.

Define What Is The Difference Between Class And Module?

Answer»

P141, P142

Class can do: inheritance, having instance, while module CAN NOT. Can be required.

Module can do: MAKE NAMESPACE to avoid NAME clash, can be INCLUDED.

#instantiate from class within module

Module A

Class B

End

b= A::B.new

P141, P142

Class can do: inheritance, having instance, while module CAN NOT. Can be required.

Module can do: make namespace to avoid name clash, can be included.

#instantiate from class within module

Module A

Class B

End

b= A::B.new

21.

Define Cucumber Report?

Answer»

Cucumber generates its own html format. DEFINE However BETTER reporting can be DONE using JENKINS or bamboo tool. Details of reporting are covered in next topic of cucumber.

Cucumber generates its own html format. Define However better reporting can be done using Jenkins or bamboo tool. Details of reporting are covered in next topic of cucumber.

22.

Define What Are The Benefits?

Answer»
  • It is HELPFUL to INVOLVE business STAKEHOLDERS who can’t EASILY read code
  • Cucumber focuses on end-user experience
  • Style of writing tests allow for easier reuse of code in the tests
  • Quick and easy set up and execution
  • EFFICIENT tool for testing

23.

What Is Support, Env.rb And Hooks.rb?

Answer»
  • Support is a foder where we can setup CUCUMBER RELATED support.
  • rb file will be used to LOAD the required libraries for cucumber scenario execution
  • rb we will add HOOKS LIKE before, after, beforeStep and afterStep hooks

24.

There Are Three Ways To Invoke A Method In Ruby. Can You Give Me At Least Two? Here, I’m Looking For The Dot Operator (or Period Operator), The Object#send Method, Or Method(:foo).call?

Answer»

object = Object.new

PUTS object.object_id

#=> 282660

puts object.send(:object_id)

#=> 282660

puts object.method(:object_id).CALL # (Kudos to EZRA)

#=> 282660

object = Object.new

puts object.object_id

#=> 282660

puts object.send(:object_id)

#=> 282660

puts object.method(:object_id).call # (Kudos to Ezra)

#=> 282660

25.

What Is Cucumber Tool?

Answer»

Cucumber is a software tool used by computer PROGRAMMERS for testing other software. It runs automated acceptance tests written in a behavior-driven development STYLE. CENTRAL to the Cucumber BDD approach is its plain language parser called GHERKIN.

Cucumber is a software tool used by computer programmers for testing other software. It runs automated acceptance tests written in a behavior-driven development style. Central to the Cucumber BDD approach is its plain language parser called Gherkin.

26.

What Is Gherkin Language?

Answer»

Gherkin is the language that CUCUMBER uses to define test cases. It is DESIGNED to be non-technical and human readable, and collectively describes use cases relating to a software system.

The purpose behind Gherkin's SYNTAX is to promote Behavior Driven Development PRACTICES across an entire development team, including business analysts and MANAGERS.

Gherkin is the language that Cucumber uses to define test cases. It is designed to be non-technical and human readable, and collectively describes use cases relating to a software system.

The purpose behind Gherkin's syntax is to promote Behavior Driven Development practices across an entire development team, including business analysts and managers.

27.

Cucumber Is Written In Which Programming Language?

Answer»

Cucumber is written in the Ruby programming LANGUAGE. It was ORIGINALLY USED exclusively for Ruby testing as a complement to the RSpec BDD framework. Cucumber now supports a variety of different programming LANGUAGES through various implementations.

Cucumber is written in the Ruby programming language. It was originally used exclusively for Ruby testing as a complement to the RSpec BDD framework. Cucumber now supports a variety of different programming languages through various implementations.

28.

Gherkins Files Have Which File Extension?

Answer»

All Gherkin FILES have the .FEATURE file extension. They CONTAIN a SINGLE Feature definition for the system under test and are an executable test script.

All Gherkin files have the .feature file extension. They contain a single Feature definition for the system under test and are an executable test script.

29.

Cucumber Tests Are Divided Into How Many Parts?

Answer»

Cucumber tests are divided into INDIVIDUAL FEATURES. These Features are subdivided into SCENARIOS, which are SEQUENCES of Steps.

Cucumber tests are divided into individual Features. These Features are subdivided into Scenarios, which are sequences of Steps.

30.

What Is A Feature In Cucumber?

Answer»

A feature is a Use Case that describes a specific function of the SOFTWARE being TESTED. There are three PARTS to a Feature [18]

  1. The Feature: keyword
  2. The Feature NAME (on the same line as the keyword)
  3. An optional description on the following lines

A feature is a Use Case that describes a specific function of the software being tested. There are three parts to a Feature [18]

31.

What Is A Scenario In Cucumber?

Answer»

Each FEATURE is made of a collection of SCENARIOS. A single scenario is a flow of events through the Feature being described and maps 1:1 with an executable test CASE for the system.[18] Keeping with the example ATM withdrawal feature, a scenario might describe how a user requests MONEY and what happens to their account.

Each Feature is made of a collection of scenarios. A single scenario is a flow of events through the Feature being described and maps 1:1 with an executable test case for the system.[18] Keeping with the example ATM withdrawal feature, a scenario might describe how a user requests money and what happens to their account.

32.

What Are Tags In Cucumber?

Answer»

Gherkin's Feature structure forces organization. However, in cases where this DEFAULT organization is inconvenient or insufficient, Gherkin PROVIDES Tags. Tags are @-prefixed strings and can be placed before.

  • Feature
  • Scenario
  • Scenario Outline

Examples: An element can have multiple tags and INHERITS from parent elements.

Gherkin's Feature structure forces organization. However, in cases where this default organization is inconvenient or insufficient, Gherkin provides Tags. Tags are @-prefixed strings and can be placed before.

Examples: An element can have multiple tags and inherits from parent elements.

33.

What Are Steps In Cucumber?

Answer»

Steps in Gherkin's .feature files can be considered a method invocation. Before Cucumber can execute a step it MUST be TOLD, via a step definition, how that step should be performed.

Definitions are WRITTEN in Ruby and conventionally filed under features/step_definitions/*_steps.rb. Definitions start with the same keywords as their invocation (including Gherkin's full LANGUAGE support). Each definition takes two arguments.

Either a regular expression or string with $variables

A block containing ruby CODE to execute

Steps in Gherkin's .feature files can be considered a method invocation. Before Cucumber can execute a step it must be told, via a step definition, how that step should be performed.

Definitions are written in Ruby and conventionally filed under features/step_definitions/*_steps.rb. Definitions start with the same keywords as their invocation (including Gherkin's full language support). Each definition takes two arguments.

Either a regular expression or string with $variables

A block containing ruby code to execute

34.

What Are Hooks In Cucumber?

Answer»

Hooks are Cucumber's way of allowing for setup to be performed prior to tests being run and teardown to be run afterward. They are defined as executable Ruby blocks, similar to JUnit methods marked with @Before, @After annotations. Conventionally they are placed under support/, and are applied GLOBALLY. Three basic types of hooks exist.

Before - Runs before a SCENARIO

After - Runs after a scenario

Around - Assumes CONTROL and runs around a scenario

ADDITIONAL hooks include

  • BeforeStep
  • AfterStep
  • AfterConfiguration - Runs after Cucumber configuration and is PASSED an instance of the configuration

Hooks are Cucumber's way of allowing for setup to be performed prior to tests being run and teardown to be run afterward. They are defined as executable Ruby blocks, similar to JUnit methods marked with @Before, @After annotations. Conventionally they are placed under support/, and are applied globally. Three basic types of hooks exist.

Before - Runs before a scenario

After - Runs after a scenario

Around - Assumes control and runs around a scenario

Additional hooks include

35.

What Are Formatter Plugins In Cucumber?

Answer»

CUCUMBER USES Formatter Plugins to provide OUTPUT. Several common formats are provided by DEFAULT, including

Cucumber uses Formatter Plugins to provide output. Several common formats are provided by default, including

36.

How Does Cucumber Works With Browser Automation?

Answer»

CUCUMBER does not provide BUILT in BROWSER automation. However, it does work well with existing gems such as Selenium and WATiR-WebDriver.[24] It does SUPPORT running tests with transactions through LEVERAGING other gems such as ActiveRecord.

Cucumber does not provide built in browser automation. However, it does work well with existing gems such as Selenium and WATiR-WebDriver.[24] It does support running tests with transactions through leveraging other gems such as ActiveRecord.