Selenium Java Interview Questions And Answers – Part 16

Selenium Java Interview Questions And Answers – Part 16

Selenium Java Interview Questions and Answers Part-16

1) Explain JUnit Runner?

A JUnit Runner is a class that extends JUnit’s abstract Runner class. Runners are used
for running test classes in a Cucumber Project. Runner class can be run by using the @RunWith annotation

2) What are the steps to generate a report in Cucumber?

For HTML reports, add html:target/cucumber-reports to the @CucumberOptions plugin option.

features = "src/test/resources/features",
glue= {"stepDefs"},
plugin = { "pretty", "html:target/cucumber-reports" },
monochrome = true


3) Full form of BDD?

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

4) Full form of TDD?

TDD stands for Test Driven Development. It is a development technique where a developer
first writes a test that fails before writing any new code.

5) Name any 3 popular BDD testing tools?

Cucumber, SpecFlow and JBehave

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

Tag names are case-sensitive.

7) Name any two testing framework that can be integrated with Cucumber?

TestNG and Junit can be easily integrated with Cucumber.

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

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

9) What software do you need to run cucumber in JAVA?

We need to add the cucumber dependencies in Maven pom.xml file of the Java project.

10) How does a JUnit Test Runner class look like?

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

features = {
plugin = {
monochrome = true

public class TestRunner {


11) Name any advanced framework design that can be used with Cucumber?

Page Object Model can be used with Cucumber.

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


13) Can you name any other BDD tools except Cucumber?

JBehave and SpecFlow

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

15) What are the JAR files to be used for Cucumber?


16) What is the real time use of Cucumber?

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

17) What is the plugin’s name that is used to integrate Cucumber into Eclipse IDE?

Cucumber Eclipse Plugin can be used for Cucumber integration in Eclipse.

18) What are the Gherkin keywords?

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

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

20) Explain the procedure how do you create cucumber end to end tests for the given test case.
launch a website google.com Enter “selenium” in search field click on search button results should be displayed.?

– Create a feature file and add the scenarios with steps in the file
– Create a step definition file and write all the methods associated with different steps of feature file
– Create a Junit Test Runner file and call the feature file by providing its path

21) Types of reports generated by cucumber JUNIT?

Following reports can be generated:

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

23) How to create feature file in Cucumber?

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

24) 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 Test NG. One can use either Maven Surefire or Failsafe plugin for executing the tests in parallel.

25) Is Cucumber open source?

Cucumber is an open source BDD framework.

Next Steps:

> More interview questions and answers on Selenium Java, continue to the next post (Click on Next Post link below)

> Check complete Selenium Java interview questions and answers here (Click here)

Please leave your questions/comments/feedback below.

Happy Learning ?

About Me > Bijan Patel

Connect to me on Linked In (Click here)

On a mission to contribute to the Software Testing Community in all possible ways.

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *