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

Bdd notes

The document outlines key Cucumber BDD interview questions and answers, covering topics such as the differences between Cucumber and JBehave, the use of Gherkin language, and the purpose of various hooks and tags. It also explains concepts like Scenario Outline, Step Definitions, and the integration of Cucumber with other tools and frameworks. Additionally, it discusses the execution process, reporting, and the use of Cucumber in real-time applications.

Uploaded by

Didem Çiçek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Bdd notes

The document outlines key Cucumber BDD interview questions and answers, covering topics such as the differences between Cucumber and JBehave, the use of Gherkin language, and the purpose of various hooks and tags. It also explains concepts like Scenario Outline, Step Definitions, and the integration of Cucumber with other tools and frameworks. Additionally, it discusses the execution process, reporting, and the use of Cucumber in real-time applications.

Uploaded by

Didem Çiçek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Most Important Cucumber BDD Interview Questions:

1)What is the difference between JBehave and Cucumber?


JBehave is pure Java Framework, and Cucumber is Ruby-based.
JBehave are based on stories while Cucumber is based on features.

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


Cucumber uses the Gherkin language to define the scenario in feature file using
keywords like Given, Then, And, When, etc

3) What Are Before, After, BeforeStep and AfterStep Hooks?


Methods annotated with @Before will execute before every scenario. Methods
annotated with @BeforeStep execute before every step. Methods annotated with
@After execute after every scenario. Methods annotated with @AfterStep
execute after every step.

4) What Are Cucumber Tags? Why we use the Tags?


Tags are a great way to organise your features and scenarios. They can be used
for two purposes: Running a subset of scenarios Restricting hooks to a
subset of scenarios

5) What Is Cucumber Dry Run?


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

6) Explain what is Scenario Outline in Feature File?


Cucumber Scenario Outline is used to execute the same scenario multiple times
with different data sets.

7) What is Step Definition in Cucumber?


Step Definition is a java method that is linked to a step in the scenario in feature
file.

8) Explain what is BDD (Behaviour Driven Development)?

1|Page LinkedIn: Shubham Sultane


BDD is an Agile software development process that encourages collaboration
among developers, QA and non-technical or business participants in a software
project.

9) Define feature file? Mention the components of feature file?


Feature file is a file which consists of scenarios, steps and conditions for
different test cases. The following are the components contained by the feature
file: Feature Scenario Scenario Outline Steps in Given/When/Then
format.

10) What is the meaning of Steps in Cucumber tool?


Each step starts with Given, When, Then, And. Cucumber executes each step in
a scenario one at a time, in the given sequence. When Cucumber tries to execute
a step, it looks for a matching step definition to execute.

11) What is the difference between Given, When, Then steps in feature file?
Given steps are used to describe the initial context of the system the scene of
the scenario.
When steps are used to describe an event, or an action.
Then steps are used to describe an expected outcome, or result.

12) What are the programming languages supported by Cucumber?


Cucumber supports many programming languages like Perl, PHP, Python, .Net
and Java.

13) How many times scenario outline will be executed?


Scenario outline is run once for each row listed in the Examples section.

14) What is background and when it will be executed?


Background contains one or more Given steps, which are run before each
scenario.

15) Explain types of Hooks in Cucumber?


Following are the different types of hooks in cucumber: Before After
BeforeStep AfterStep

2|Page LinkedIn: Shubham Sultane


16) What is the pattern of writing Given, When, Then, And?
There is no strict pattern of writing these keywords and can be interchangeably
used based on the scenarios.

17) What is the use of glue property under Cucumber Options tag?
The glue is a part of Cucumber options that describes the location and path of
the step definition file.

18) What is the difference between Cucumber, JBehave and Specflow?


Cucumber is based on Ruby while JBehave is a Java based framework and
Specflow is a .Net based framework.

19) What are the two main purpose of using Gherkin?


Documents user scenarios
Writing an automated test in BDD

20) How to comment a line in Feature file?


.

21) Explain Cucumber Hooks?


Hooks are blocks of code that can run at various points in the Cucumber
execution cycle. They are typically used for setup and teardown of the
environment before and after each scenario.

22) Name any 3 popular BDD testing tools?


Cucumber, SpecFlow and JBehave

23) Cucumber Tags are case sensitive. True or False?


Tag names are case-sensitive.

24) Name any two testing frameworks that can be integrated with
Cucumber?
TestNG and Junit can be easily integrated with Cucumber.

25) Name any two build management tools that can be integrated with
Cucumber?

3|Page LinkedIn: Shubham Sultane


Maven and Ant are two build management tools which can be integrated with
cucumber.

26) Name any advanced framework design that can be used with
Cucumber?
Page Object Model can be used with Cucumber.

27) Selenium can be integrated with Cucumber. True or False?


True

28)) Can you name any other BDD tools except Cucumber?
Behave, JBehave, and SpecFlow

29) Can we write cucumber tags ( @smoke , @Run etc ) above feature
keyword in feature file?
Yes. We can write these cucumber tags above the feature keyword.

30) What is the real time use of Cucumber?


Cucumber is used to write acceptance tests for a web application.

31
Eclipse IDE?
Cucumber Eclipse Plugin can be used for Cucumber integration in Eclipse.

32) What are the Gherkin keywords?


The main keywords in Gherkin are: Feature, Scenario, Given, When, Then,
And, But (Steps) Background Scenario outline Examples

33) If Before hook is available and background is available for a scenario,


in which order they will be executed?
Before hook will be executed first followed by the background steps for a
scenario.

4|Page LinkedIn: Shubham Sultane


34) Types of reports generated by cucumber JUNIT?
Following reports can be generated:
HTML
XML
JSON

35) How to run multiple feature files in Cucumber?


We can mention all the different feature file paths or the folder path in Junit
Runner file.

36) How to create feature file in Cucumber?


Create a new file with .feature extension under src/test/resources/features folder.

37) How to run Cucumber tests in parallel?


Cucumber can be executed in parallel using TestNG and Maven test execution
plugins by setting the DataProvider parallel option to true. Using the scenario
outline we can execute multiple scenarios with TestNG. One can use either
Maven SureFire plugin for executing the tests in parallel.

38) Is Cucumber open source?


Yes, Cucumber is an open source BDD framework.

39) What is the starting point of execution for feature files?


TestRunner is the starting point of execution.

40) Should any code be written within TestRunner class?


In a default TestRunner class, no code is required to execute it.

41) Can we use same step definition in different scenarios?


Yes. We can use same step definition in multiple scenarios.

42) What is the maximum number of steps that are to be written within a
scenario?
There is no fixed limit of steps within a scenario and it is completely dependent
on the application.

5|Page LinkedIn: Shubham Sultane


43) What software do you need to run a Cucumber Tests?
We need any IDE like Eclipse or IntelliJ and setup a Maven Java Project. Then
we need to add maven dependencies for cucumber-JVM, cucumber-core and
cucumber-Junit. After that we need to add Feature Files, Step Definition Files
and Test Runner file to run a cucumber test.

44) Cucumber Execution Starts from Where?


Cucumber execution starts from TestRunner file.

45) On what places you can write tags in feature file?


Tags can be placed above the following elements:
Feature
Scenario
Scenario Outline
Examples

46) What are the prerequisites for building a Selenium Cucumber


automation framework?
We need to include the relevant Maven dependencies for Selenium and
Cucumber.

47) What are Data Tables in Cucumber?


Data Tables are used in Examples for Scenario Outline. Scenario will be
executed for every row in the data table.

48) What are the cucumber assertions?


t have its own assertion library and we need to use the
assertions available in any testing framework like TestNG or Junit.

49) What is Cucumber Report? Mention the benefits of Cucumber Report?


Cucumber Report contains details of the test execution like which scenarios
passed or failed, what are the steps within the scenarios, and other environment
details. This report can be shared with the project stakeholders for reporting
purpose.

6|Page LinkedIn: Shubham Sultane


50) Can we use TestNG with Cucumber?
Yes. We can use TestNG with cucumber. For that we need to extend
AbstractTestNGCucumberTests Class in Test Runner class.

51) What is the main difference between Scenario and Scenario outline?
-Scenario can be executed only once but Scenario outline can be used to
execute scenario multiple times with different sets of data.
-
contain examples.

52) Mention the main reasons behind using a simple programming


language such as Gherkin?
Gherkin is used in Cucumber to make it easy for non-technical people to
understand the scenarios as it is quite similar to English language. Business
Analysts can easily convert the business requirements into-
Features/Scenarios/Steps using Gherkin.

7|Page LinkedIn: Shubham Sultane

You might also like