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

Cucumber Testing Multiple-Choice Questions (MCQs) _ JavaInUse

The document contains multiple-choice questions (MCQs) related to Cucumber testing, focusing on its features, keywords, and functionalities. Key topics include the Gherkin language, step definitions, hooks, and the purpose of various keywords such as 'Given', 'When', 'Then', and 'But'. It serves as a quiz format to assess knowledge on Cucumber's behavior-driven development (BDD) framework.

Uploaded by

Madhu Mathi
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)
4 views

Cucumber Testing Multiple-Choice Questions (MCQs) _ JavaInUse

The document contains multiple-choice questions (MCQs) related to Cucumber testing, focusing on its features, keywords, and functionalities. Key topics include the Gherkin language, step definitions, hooks, and the purpose of various keywords such as 'Given', 'When', 'Then', and 'But'. It serves as a quiz format to assess knowledge on Cucumber's behavior-driven development (BDD) framework.

Uploaded by

Madhu Mathi
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/ 14

4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

Cucumber Testing Multiple-Choice


Questions (MCQs)

Q. What is Cucumber?
A testing framework for behavior-driven development (BDD)
A database management system
A programming language
A version control system

Check Answer

Correct answer. Cucumber is a testing framework that supports Behavior Driven Development
(BDD). It allows you to write test cases in plain language that can be understood by non-technical
stakeholders.

Q. Which language is used to write Cucumber scenarios?


Java
Python
Gherkin
Ruby

Check Answer

Correct answer. Cucumber scenarios are written in Gherkin language. Gherkin uses a set of
special keywords to give structure and meaning to executable specifications.

Q. What is a Feature file in Cucumber?


A file containing step definitions
Close X

A file containing test scenarios written in Gherkin


A configuration file for Cucumber

https://www.javainuse.com/quiz/cuc 3/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

A file containing test results

Check Answer

Correct answer. A Feature file in Cucumber contains test scenarios written in Gherkin language. It
describes a single feature of the system using natural language statements.

Q. What is the purpose of Step Definitions in Cucumber?


To write test scenarios
To configure Cucumber
To map Gherkin steps to code
To generate test reports

Check Answer

Correct answer. Step Definitions in Cucumber are used to map the Gherkin steps to actual code
implementation. They define how each step in a scenario should be executed.

Q. Which keyword is used to start a Cucumber scenario?


Given
When
Then
Scenario

Check Answer

Correct answer. The keyword Scenario is used to start a Cucumber scenario. It is followed by a
brief description of the scenario.

Q. What does the "Given" keyword represent in a Cucumber


scenario?
The precondition or initial context
The action performed by the user
The expected outcome Close X

https://www.javainuse.com/quiz/cuc 4/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

The end of the scenario

Check Answer

Correct answer. The Given keyword in a Cucumber scenario represents the precondition or initial
context. It sets up the state of the system before the user starts interacting with it.

Q. What is a Scenario Outline in Cucumber?


A summary of all scenarios
A template for multiple scenarios with different data
An outline of the entire feature
A description of test steps

Check Answer

Correct answer. A Scenario Outline in Cucumber is a template for multiple scenarios with different
data. It allows you to run the same scenario multiple times with different sets of input data.

Q. Which keyword is used to provide example data for a


Scenario Outline?
Data
Examples
Inputs
Values

Check Answer

Correct answer. The Examples keyword is used to provide example data for a Scenario Outline in
Cucumber. It is followed by a table of data that will be used to run the scenario multiple times.

Q. What is the purpose of tags in Cucumber?


To add comments to scenarios
To group and organize scenarios
To define step definitions Close X

https://www.javainuse.com/quiz/cuc 5/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

To create test data

Check Answer

Correct answer. Tags in Cucumber are used to group and organize scenarios. They allow you to
selectively run certain scenarios, hook into specific scenarios for setup or teardown, and generate
reports based on tags.

Q. What is a Background in Cucumber?


A description of the feature
A set of steps that run before each scenario in a feature
A way to provide context to step definitions
A method to define global variables

Check Answer

Correct answer. A Background in Cucumber is a set of steps that run before each scenario in a
feature. Its used to avoid repetition of common steps across multiple scenarios within the same
feature.

Q. Which command is used to run Cucumber tests from the


command line?
cucumber run
cucumber test
cucumber
run cucumber

Check Answer

Wrong! The correct answer is C. The command cucumber is used to run Cucumber tests from the
command line. You can also specify additional options and arguments with this command.

Q. What is the purpose of the "And" keyword in Cucumber


scenarios?
Close X

To combine multiple features


To add additional conditions to a step

https://www.javainuse.com/quiz/cuc 6/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

To create loops in scenarios


To define variables

Check Answer

Correct answer. The And keyword in Cucumber scenarios is used to add additional conditions or
actions to a step. It helps in making scenarios more readable by avoiding repetition of Given,
When, or Then.

Close X

https://www.javainuse.com/quiz/cuc 7/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

Q. What is a Hook in Cucumber?


A way to skip scenarios
A method to define global variables
A block of code that runs before or after scenarios
A tool for debugging scenarios
Close X
Check Answer

https://www.javainuse.com/quiz/cuc 8/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

Correct answer. A Hook in Cucumber is a block of code that runs before or after scenarios. Its
used for setup and teardown operations that are common across multiple scenarios or features.

Q. Which of the following is NOT a valid Gherkin keyword?


Feature
Scenario
Given
Execute

Check Answer

Correct answer. Execute is not a valid Gherkin keyword. The main Gherkin keywords are Feature,
Scenario, Given, When, Then, And, But, Background, Scenario Outline, and Examples.

Q. What is the purpose of the "But" keyword in Cucumber


scenarios? (https://www.statcounter.com/)

© Copyright JavaInUse. All Rights Reserved. Privacy Policy (/privacy)


To negate a previous step
(https://www.positivessl.com/the-positivessl-trustlogo)
To create conditional scenarios
To add exceptions or contrasts
To end a scenario

Check Answer

Wrong! The correct answer is C. The But keyword in Cucumber scenarios is used to add
exceptions or contrasts. Its similar to And but used when you want to note a contrast or
exception to the previous step.

Q. What is a Step Definition in Cucumber?


A Gherkin step in a scenario
A method that implements a step in a scenario
A type of assertion in Cucumber
A way to define variables in Cucumber

Check Answer Close X

https://www.javainuse.com/quiz/cuc 9/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

Correct answer. A Step Definition in Cucumber is a method that implements a step in a scenario.
It maps the Gherkin steps in feature files to actual code that performs the actions described in
the steps.

Q. What is the purpose of the "@" symbol in Cucumber?


To define variables
To create comments
To specify tags
To indicate optional steps

Check Answer

Correct answer. The @ symbol in Cucumber is used to specify tags. Tags are used to organize
and selectively run scenarios, as well as to apply hooks to specific scenarios or features.

Q. What is a Data Table in Cucumber?


A way to store test data externally
A tabular data structure passed to step definitions
A type of assertion for comparing data
A method to generate random test data

Check Answer

Correct answer. A Data Table in Cucumber is a tabular data structure that can be passed to step
definitions. It allows you to specify more complex data directly in your Gherkin scenarios.

Q. Which of the following is true about Cucumber reports?


They can only be generated in HTML format
They are automatically sent by email after each test run
They can be generated in various formats including HTML and JSON
They only show passed scenarios

Check Answer
Close X

https://www.javainuse.com/quiz/cuc 10/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

Correct answer. Cucumber reports can be generated in various formats including HTML and
JSON. These reports provide detailed information about test execution, including passed, failed,
and skipped scenarios.

Q. What is the purpose of the "Doc Strings" feature in


Cucumber?
To add comments to scenarios
To include large amounts of text in a step
To define documentation for step definitions
To create multi-line assertions

Check Answer

Correct answer. Doc Strings in Cucumber are used to include large amounts of text in a step.
They are useful when the step has a table of data or multiple lines of text that need to be passed
to the step definition.

Q. What is a Cucumber Expression?


A way to write complex assertions
A simplified version of regular expressions for matching step definitions
A method to combine multiple scenarios
A type of Gherkin syntax

Check Answer

Correct answer. Cucumber Expressions are a simplified version of regular expressions used for
matching step definitions. They provide a more readable and maintainable way to define step
patterns compared to traditional regular expressions.

Q. What is the purpose of the "Before" hook in Cucumber?


To define preconditions for scenarios
To run code before each scenario
To set up test data
Close X
All of the above

Check Answer
https://www.javainuse.com/quiz/cuc 11/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

Correct answer. The Before hook in Cucumber serves multiple purposes: it can define
preconditions for scenarios, run code before each scenario, and set up test data. It's a powerful
tool for setting up the test environment.

Q. Which command is used to generate step definitions for


undefined steps in Cucumber?
cucumber --generate
cucumber --undefined
cucumber --dry-run
cucumber --steps

Check Answer

Wrong! The correct answer is C. The command cucumber --dry-run is used to generate step
definitions for undefined steps in Cucumber. It runs through your features without actually
executing them and outputs the missing step definitions.

Q. What is the purpose of the "World" object in Cucumber?


To store global variables
To define the testing environment
To share state between steps
To create test data

Check Answer

Wrong! The correct answer is C. The World object in Cucumber is used to share state between
steps. It provides a way to store and access data that needs to be available across different step
definitions within a scenario.

Q. What is a Transformer in Cucumber?


A tool to convert feature files to step definitions
A method to change the execution order of scenarios
A function to convert step definition parameters
Close X
A way to modify Gherkin syntax

Check Answer
https://www.javainuse.com/quiz/cuc 12/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

Wrong! The correct answer is C. A Transformer in Cucumber is a function used to convert step
definition parameters. It allows you to automatically transform the string arguments passed to
step definitions into more complex types or objects.

Q. What is the purpose of the "After" hook in Cucumber?


To define postconditions for scenarios
To run code after each scenario
To clean up test data
All of the above

Check Answer

Correct answer. The After hook in Cucumber serves multiple purposes: it can define
postconditions for scenarios, run code after each scenario, and clean up test data. It's commonly
used for teardown operations.

Q. What is a Step Argument in Cucumber?


A variable passed to a step definition
A way to create reusable steps
A type of assertion
A method to skip steps

Check Answer

Correct answer. A Step Argument in Cucumber is a variable passed to a step definition. It allows
you to parameterize your steps, making them more flexible and reusable across different
scenarios.

Q. What is the purpose of the "Rule" keyword in Cucumber?


To define test rules
To group related scenarios
To create conditional tests
To specify test priorities
Close X

Check Answer

https://www.javainuse.com/quiz/cuc 13/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

Wrong! The correct answer is B. The Rule keyword in Cucumber is used to group related
scenarios. It helps in organizing scenarios that belong to a particular business rule or feature
aspect, improving the readability and structure of feature files.

Q. What is a Tagged Hook in Cucumber?


A hook that only runs for scenarios with specific tags
A way to tag step definitions
A method to create custom tags
A tool for organizing hooks

Check Answer

Correct answer. A Tagged Hook in Cucumber is a hook that only runs for scenarios with specific
tags. It allows you to apply certain setup or teardown operations only to scenarios that have
been tagged with particular labels.

Q. What is the purpose of the "* " (asterisk) in Gherkin


syntax?
To indicate an optional step
To create a wildcard step
To define a step that can be either Given, When, or Then
To comment out a step

Check Answer

Correct answer. The * (asterisk) in Gherkin syntax is used to define a step that can be either Given,
When, or Then. It's a shorthand that allows you to write steps without specifying their exact
nature, which can be useful in certain scenarios.

Q. What is a Cucumber Profile?


A set of default configurations for running Cucumber tests
A way to create user profiles for testing
A tool for profiling test performance
Close X
A method to define custom step definitions

Check Answer
https://www.javainuse.com/quiz/cuc 14/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

Wrong! The correct answer is A. A Cucumber Profile is a set of default configurations for running
Cucumber tests. It allows you to define different sets of options for running your tests, which can
be easily switched between using command-line arguments.

Q. What is the purpose of the @wip tag in Cucumber?


To mark a feature as high priority
To indicate a work in progress
To specify a Windows IP address
To create a web interface for the test

Check Answer

Wrong! The correct answer is B. The @wip tag in Cucumber stands for work in progress. Its
commonly used to mark scenarios or features that are still being developed or are not yet ready
for full testing, allowing testers to easily exclude or focus on these items during test runs.

Q. What is a Custom Formatter in Cucumber?


A tool to format Gherkin syntax
A way to create custom step definitions
A method to generate custom test reports
A feature to format test data

Check Answer

Wrong! The correct answer is C. A Custom Formatter in Cucumber is a method to generate


custom test reports. It allows you to define how Cucumber should output the results of your
tests, enabling you to create reports in specific formats or with particular information included.

Q. What is the purpose of the "Pending" status in


Cucumber?
To indicate a passing test
To mark a test as blocked
To show that a step definition is not yet implemented
Close X
To highlight a high priority test

Check Answer
https://www.javainuse.com/quiz/cuc 15/19
4/22/25, 5:41 AM Cucumber Testing Multiple-Choice Questions (MCQs) | JavaInUse

Correct answer. The Pending status in Cucumber is used to show that a step definition is not yet
implemented. It's a way to indicate that a scenario has been defined but the corresponding step
definition code hasn't been written yet.

Popular Posts
Spring Boot Interview Questions (/spring/SpringBootInterviewQuestions)
Implement Spring Boot Security and understand Spring Security
Architecture (/webseries/spring-security-jwt/chap3)
E-commerce Website - Online Book Store using Angular 8 + Spring Boot
(/fullstack/ecommerce)
Spring Boot +JSON Web Token(JWT) Hello World Example (/spring/boot-
jwt)
Angular 7 + Spring Boot Application Hello World Example (/spring/ang7-
hello)
Build a Real Time Chat Application using Spring Boot + WebSocket +
RabbitMQ (/spring/boot-websocket-chat)
Pivotal Cloud Foundry Tutorial - Deploy Spring Boot Application Hello
World Example (/pcf/pcf-hello)
Deploying Spring Based WAR Application to Docker
(/devOps/docker/docker-war)
EIP patterns using Apache Camel (/camel/camel_EIP)
Spring Cloud- Netflix Eureka + Ribbon Simple Example
(/spring/spring_ribbon)
Spring Cloud- Netflix Hystrix Circuit Breaker Simple Example
(/spring/spring_hystrix_circuitbreaker) Close X

https://www.javainuse.com/quiz/cuc 16/19

You might also like