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

Cucumber Interview Questions

Cucumber interview questions

Uploaded by

sandhiya San
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Cucumber Interview Questions

Cucumber interview questions

Uploaded by

sandhiya San
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

1. What is the difference between Scenario and Scenario Outline?

------------

Using Scenario Outline we can able to test the application with the multiple set of
data.

This one is for whole test

We can say number of data sets is equal to number of scenario.

We must use headers to identify the data sets.

We must use the examples keyword to provide the multiple rows along with headers.

However Scenario helps to create either data table or step level cucumber
expression

Data table is a class using that we can implement the data sets in the step level
and it's not for
whole test.

We have different pre defined functions in datatable like asList, asLists, asMap
and asMaps and all,

Using that we can convert table to either list or map object.

No mandatory rule to have headers here. We can define the data sets without headers
as well.

2. What is the difference between Background and Hooks?


----------------

Background is used in the feature file level to write the common pre steps(Mostly
Given) in the scenario level.

We can use only one background inside one feature file. Like browser Initilization
or Deleting the cookies, Writing logs can be written
inside the background. It even helps stack holder get some idea with respect to
precodntions.

If i talk about hooks is something which will be written in the class level to
acheive both pre and post condition.

Hooks will be executed first before background gets invoked.

Hooks available in the form of annotations like @Before @After @BeforeStep


@AfterStep like that, So we can apply hooks
in the feature level, scenario level, or step level, even we can apply ordered or
Tagged Hooks.

Only difficulties, its not the part of feature file.

3. What are the different cucumber Options are available?


--------------------------------

We can implement cucumber options either by Junit or TestNG.

using @RunWith(Cuucumber.class) and Cucumber Options which will includes,


features -> To mention the path of the feature file
glue --> To give the step defintion package name
dryRun --> To compare the feature file step with the step definion class, It will
not allow us the execute the code and it will give the missing snippets.
strict -> Its also to compare feature file with step definion but it will execute
the code and make suite as failed if there is a missing snippets
monochrome --> To remove unwanted symbols from the consoalble report
plugin --> To generate the various reports, HTML , XML, JSON REPORTS
tags --> To filter particular sceanrio and features.

4. What is Tags?
----------------

Tags can be applied in the feature file or Scenario level through @tagName.

and it should be written inside the runner class to filter the particular scenario
or feature.

In some cases we have the requirement common pre and post requisties of few
scneaio's there
we can get the tagged hooks as well.

If we want to ignore partcular scenario we can use tilt symbol (~) while writing
the tag name in the runner class.

5. DryRun vs Strict
---------------------

When we set dryRun and Strict as true, basically both help us to compare feature
file steps against Step definion class and will give the
missing snippets.

However DryRun will not allow us to exeucute the code where as Strict will exeucte
the code.

If thers is a missing snippets strict will make entire suite as an error.

6. What are the two main components of Cucumber?


-------------

Feature File -> To define the bahaviour of the applications through gherkin
language using keywords like Given, When, And, Then, But and So..
Step Definion -> Its a class file to write the implementation of the steps written
inside the feature file.

7. What is Feature File?


-------------

Feature File is used in Cucumber to define the behaviours through Gherkin using
different keywords like Given When And Then But So..

We can have different sections like Feature, Scenario, Scenario Outline With
Examples and Background And all.

We can also exeucte the code from the feature file itself. It should have an
extension ".feature"

8. What is Step definion?


------------------
Step definion is the Java Class to give the implementation of feature File steps.

We should implement the feature file steps through annotation @Given, @When, @and,
@Then like that...

9. What is Cucumber?
--------------------

Cucumber is a framework or tool which is to implement the BDD Process in


Automation.

Cucumber is OS and Free of Cost tool and It supports almost all the Programming
language.

It has three important Components like Feature file, step definion class,
Junit/TestNG Runner Class.

10. What is BDD?


-------------------

BDD - Behavioural Driven Development.

It the Process used in software projects to perform end to end flow on Products.

Its not only for testers, everyone in the team or Company made their collaboration
through BDD.

Basically In the Projects, Once the PO, DEV team and QA Team after agreed upon the
business requirements they
will convert that into Englih formatted scenarios using Gherkin language.

So this scenarios used by the developer to develop an app,and testers use the same
scenarios to test the app and PO
use this one for Acceptance level of testing.

So here we are doing behavioural centric approach as the top one to write our
development code or Automation scripts.

Here the dev Code/Automation scripts is dricen by English formatted Gherkin


Scenarios.

11. TDD vs BDD?


--------------

TDD -> Test Driven Development

We will directly define the test scripts and making it fail then will add
refactoring code to make them pass. This cycle goes On.

We can implement via either Junit or TestNG.

Its Test first approach or Code centric approach. Only technical persons can able
to understand code level things.

BDD --> Behavioural driven development

Whereas In BDD We will write the scenarios first and convert that into code and
making it fail then will add refactoring code to make them pass. This cycle goes
On.

We can implement via either Cucumber, Jbehave or Spec Flow

Its behavioural first approach or Behavioural centric approach. Everyone in the


team can able to understand.

12. How to Acheive data driven testing through Cucumber or Parameterization through
Cucumber?
--------------------------------------

Data driven testing is acheivable in three ways,

1. In the Step level, Using Cucumber or Regular expressions we can able to send the
data from feature file to Step definion.

2. Using Datatable, Below the feature file steps we can given the data sets using
pipe symbol and then we can convert this table
by Datatable class.
Datatable class has different methods like asList, asLists, asMap and asMaps.
This one is for single test
3. Third way using Scenario Outline with Examples - we can able to test the
application with the multiple set of data.
This one is for whole test

13. What Plugin used by the Cucumber?


----------------

* Natural Plugin
* Cucumber Plugin --> Active plugin and getting frequent releases.

14. What Jar Files required to Run Cucumber?


--------------------

* Cucumber-Java
* Cucumber-Junit/Testng

15. What is glue?


----------

To define the path of Step defintion package.

16. Gherkin Keywords Explanation?


------------

Given - To describe the initial context of the system


When - Its define an even or Actions to be performed
And -> If we have successive Given's when's Then's, we can use this keyword
Then -> To describe expected outcome or result

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy