0% found this document useful (0 votes)
66 views30 pages

Cucumber MCQs

Uploaded by

lalithsaikumary
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)
66 views30 pages

Cucumber MCQs

Uploaded by

lalithsaikumary
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/ 30

Cucumber MCQs

1. Introduction to Cucumber
Question:
Which of the following are true advantages of using Cucumber in BDD? (Select all
that apply)

A. Allows only technical teams to write tests in code-heavy formats

B. Enhances collaboration between technical and non-technical teams

C. Requires extensive programming knowledge for all users

D. Provides human-readable language to define test scenarios

E. Allows integration with various automation frameworks like Selenium

Answer: B, D, E

2. Behavior-Driven Development (BDD)


Match the Following:
Match the roles with their common contributions to BDD practices in a Cucumber
project.

Role Contribution

Product Manager A. Writes step definitions to link scenarios

QA Engineer B. Reviews feature file scenarios to confirm intent

Developer C. Creates Gherkin scenarios and updates requirements

Business Analyst D. Assists in defining acceptance criteria with Gherkin

Answer:

Product Manager - C

QA Engineer - B

Developer - A

Business Analyst - D

Cucumber MCQs 1
3. Gherkin Syntax
Question:
Which of the following best describes the purpose of Gherkin language in
Cucumber? (Select all that apply)

A. Provides a rigid syntax, limiting collaboration

B. Uses a structured format to describe expected application behavior

C. Facilitates shared understanding by using plain English

D. Helps in writing complex programming logic for automation

Answer: B, C

4. Writing Gherkin Scenarios


Question:
In Gherkin, which keywords are essential to structure a scenario properly? (Select
all that apply)

A. Feature

B. Test

C. Given

D. Scenario

E. And

Answer: A, C, D, E

5. Feature Files
Question:

Which of the following best practices should be followed when creating Cucumber
feature files? (Select all that apply)

A. Each feature file should address multiple features and scenarios

B. Keep scenarios concise and focused on one aspect of the feature

C. Name feature files clearly based on their functionality

Cucumber MCQs 2
D. Avoid using tags to filter scenarios in different test environments

Answer: B, C

6. Tags in Cucumber
Match the Following:
Match the tag with its purpose in a Cucumber test suite.

Tag Purpose

@smoke A. Run specific scenarios on production environment

@regression B. Identify scenarios for quick, basic checks

@UAT C. Runs in-depth checks after a code update

@integration D. Validate end-to-end workflows with dependencies

Answer:

@smoke - B

@regression - C

@UAT - A

@integration - D

7. Step Definitions
Question:

When implementing step definitions in Cucumber, which of the following should


be considered? (Select all that apply)

A. Step definitions should directly link to application-specific methods

B. Avoid reusing step definitions across multiple scenarios

C. Define a step for each unique Gherkin step to improve reusability

D. Organize step definitions into separate files by feature

Answer: A, C, D

8. Parameterization in Step Definitions

Cucumber MCQs 3
Question:
In Cucumber, which of the following are examples of parameterization for
reusable step definitions? (Select all that apply)

A. Directly hardcoding values into each step definition

B. Using placeholders within the step to receive dynamic values

C. Utilizing Examples table with Scenario Outline

D. Only defining one parameterized step definition per feature

Answer: B, C

9. Hooks in Cucumber
Question:

Which of the following are correct usages of hooks in Cucumber? (Select all that
apply)

A. Before hooks are used to set up initial test data

B. After hooks clean up post-test state or data

C. Tagged hooks are limited to pre-defined tags only

D. Before hooks are executed after each test scenario

Answer: A, B

10. Cucumber Options


Question:

Which of the following options can be used in the @CucumberOptions annotation in


Cucumber? (Select all that apply)

A. features

B. scenarios

C. glue

D. plugin

Answer: A, C, D

Cucumber MCQs 4
11. Gherkin Syntax and Parameterization
Question:

Which of the following best describes the usage of Scenario Outline in Gherkin?
(Select all that apply)

A. It allows reusing the same scenario with multiple sets of data

B. Only supports one example per scenario

C. Requires an Examples table to provide input data

D. Scenario Outline cannot use parameterization

Answer: A, C

12. Cucumber Feature Files and Naming Conventions


Question:

What are the recommended practices for naming feature files in a Cucumber
project? (Select all that apply)

A. Name feature files by feature functionality for clarity

B. Use generic names to make files reusable

C. Avoid lengthy names; keep them short and descriptive

D. Include the word Test in every feature file name

Answer: A, C

13. Scenario and Scenario Outline Differences


Match the Following:
Match the scenario type with its correct characteristic.

Scenario Type Characteristic

Scenario A. Supports single scenario per example

Scenario Outline B. Requires Examples table for multiple test data inputs

Cucumber MCQs 5
Answer:

Scenario - A

Scenario Outline - B

14. Hooks in Cucumber


Question:

Which of the following correctly describes Tagged Hooks in Cucumber? (Select all
that apply)

A. Tagged hooks execute only for scenarios with specified tags

B. Cannot use multiple tags in a single hook

C. Tagged hooks are optional but provide flexibility

D. Tagged hooks are set up in @CucumberOptions annotation

Answer: A, C

15. Running Cucumber Tests with @CucumberOptions


Question:

In @CucumberOptions , what is the purpose of the strict option? (Select one)

A. Ensures all features run in a random order

B. Fails the test if there are any undefined or pending steps

C. Automatically ignores any failed test cases

D. Skips scenarios without matching tags

Answer: B

16. Cucumber Collaboration in BDD


Question:

In a BDD setup, which stakeholders should contribute to writing Gherkin


scenarios? (Select all that apply)

A. Only technical developers

Cucumber MCQs 6
B. Business analysts

C. QA engineers

D. Product owners

Answer: B, C, D

17. Step Definitions Best Practices


Question:
Which of the following best practices should be followed in organizing Cucumber
step definitions? (Select all that apply)

A. Group step definitions by feature or related functionality

B. Define each step as specific as possible to avoid reuse

C. Use meaningful method names for each step definition

D. Avoid duplication of step definitions across different feature files

Answer: A, C, D

18. Gherkin Keywords - Given, When, Then, And, But


Match the Following:
Match the Gherkin keyword with its typical use.

Keyword Use

Given A. Defines a condition or precondition

When B. Describes an action or event performed in the scenario

Then C. Specifies an expected outcome or result

And/But D. Adds conditions or steps to the existing statement

Answer:

Given - A

When - B

Then - C

Cucumber MCQs 7
And/But - D

19. Examples of Parameterization


Question:
How does parameterization in Scenario Outline improve test coverage? (Select all
that apply)

A. Allows running the same scenario with different data sets

B. Helps maintain consistency across all step definitions

C. Reduces redundancy by eliminating repetitive scenarios

D. Enables testing multiple paths for a single scenario

Answer: A, C, D

20. Cucumber Tags and Filtering Scenarios


Question:
When using tags in Cucumber, which of the following statements are correct?
(Select all that apply)

A. Tags can only be applied to feature files, not individual scenarios

B. Multiple tags can be combined to filter specific tests

C. Tags can be added to run subsets of scenarios for different environments

D. Tagging helps in managing the scope of tests in large projects

Answer: B, C, D

21. Hooks and Test Setup


Question:
Which of the following hooks would you use to set up a browser session before
each test scenario?

A. @BeforeAll

B. @Before

Cucumber MCQs 8
C. @After

D. @BeforeScenario

Answer: B

22. Writing Effective Cucumber Feature Files


Question:

Which statements are true about writing effective Cucumber feature files? (Select
all that apply)

A. Feature files should be understandable by non-technical stakeholders

B. Only one feature file should be created for an entire application

C. Scenarios should focus on expected behavior, not implementation details

D. Avoid writing lengthy scenarios with too many steps

Answer: A, C, D

23. Running Tests with Cucumber


Match the Following:

Match each Cucumber option with its function.

Option Function
features A. Specifies the folder path to locate the feature files
glue B. Specifies package path for step definitions
dryRun C. Validates steps without running tests
monochrome D. Formats console output in readable format

Answer:

features - A

glue - B

dryRun - C

monochrome - D

Cucumber MCQs 9
24. Common Cucumber Options
Question:

Which of the following is true about using the plugin option in Cucumber? (Select
one)

A. It can only output results in JSON format

B. It can format output to HTML, JSON, or XML formats

C. It only supports console output

D. It doesn’t allow specifying output formats for reports

Answer: B

25. Collaboration in BDD Environment


Question:
In a real-world BDD project, which of the following are challenges that Cucumber
can help overcome? (Select all that apply)

A. Misunderstanding requirements due to lack of clear communication

B. Code duplication across multiple test scenarios

C. Lack of a collaborative tool for business and technical teams

D. Reducing the need for business team involvement in testing

Answer: A, B, C

26. Scenario-Based Real-World Application


Question:
If a product manager requests last-minute changes in acceptance criteria, how
would Cucumber help in making these updates? (Select all that apply)

A. Allows easy updates in Gherkin without changing code

B. Changes require rebuilding all step definitions from scratch

C. Enables testers to update scenarios without coding knowledge

Cucumber MCQs 10
D. Automatically reflects changes in step definitions with Gherkin update

Answer: A, C

27. Advanced Cucumber Options


Question:

Which of the following correctly describe the purpose of the plugin option in
@CucumberOptions ? (Select all that apply)

A. Directs Cucumber output to a specified format (e.g., HTML, JSON)

B. Can be used to generate step definition summaries

C. Automatically organizes test results into a database

D. Is primarily used to customize reporting formats

Answer: A, D

28. Importance of Tags in Real-World Testing


Question:
Which of the following describes the importance of using tags in enterprise
testing? (Select all that apply)

A. Facilitates running only selected tests in different environments

B. Helps create consistent test configurations across environments

C. Reduces the need to organize scenarios into feature files

D. Assists in scheduling tests for continuous integration (CI)

Answer: A, B, D

29. Using Multiple Tags in Scenarios


Question:
When multiple tags are used in a scenario, which of the following are true? (Select
all that apply)

Cucumber MCQs 11
A. Cucumber executes scenarios if at least one tag matches

B. Tags help filter scenarios for specific runs, such as @regression and
@smoke

C. A scenario can only have one tag at a time

D. Multiple tags allow flexibility in categorizing test scenarios

Answer: A, B, D

30. Troubleshooting Undefined Step Definitions


Question:
If Cucumber displays "Undefined step" warnings, what steps should be taken to
troubleshoot this issue? (Select all that apply)

A. Ensure that the step definitions package path is correctly set in


@CucumberOptions

B. Check that step definitions match the wording and capitalization of Gherkin
steps

C. Define new steps even if similar steps exist to avoid conflicts

D. Run Cucumber with dryRun to validate mappings without executing steps

Answer: A, B, D

31. Parameterization in Step Definitions


Question:

Which of the following methods can be used to handle parameterized steps in


step definitions? (Select all that apply)

A. Use regular expressions to capture dynamic values in Gherkin steps

B. Use placeholders in Scenario Outline Examples tables

C. Define multiple versions of the same step for different values

D. Use data-driven testing frameworks outside of Cucumber

Answer: A, B

Cucumber MCQs 12
32. Hooks and Tagged Hooks in Real-World Use
Match the Following:
Match the hook type with its primary use in a real-world testing setup.

Hook Type Use

@Before A. Initializes data or configurations before each scenario

@After B. Cleans up data or configurations post scenario execution

Tagged Hooks C. Applies setup/cleanup to specific tagged scenarios only

@BeforeAll D. Executes once before all tests run for global setup

Answer:

@Before - A

@After - B

Tagged Hooks - C

@BeforeAll - D

33. Running Cucumber Tests in Different Environments


Question:

To run tests across different environments (e.g., development, staging), which


strategies would be effective? (Select all that apply)

A. Use environment-specific tags (e.g., @dev, @staging)

B. Set up environment-based configurations in @CucumberOptions

C. Hardcode environment paths in step definitions

D. Configure environment variables that tests access during runtime

Answer: A, D

34. Structuring Step Definitions for Reusability


Question:

Cucumber MCQs 13
Which practices improve the reusability of step definitions in Cucumber? (Select
all that apply)

A. Define generic steps that can adapt to different scenarios

B. Avoid overloading single steps with multiple actions

C. Write steps specific to one feature only

D. Use parameterization to make steps flexible for different data

Answer: A, B, D

35. Best Practices in Writing Gherkin Scenarios


Question:
Which of the following are recommended best practices when writing Gherkin
scenarios? (Select all that apply)

A. Write scenarios with one expected outcome per step

B. Avoid ambiguous terms; use precise and clear language

C. Use technical terms in Gherkin steps for accuracy

D. Structure scenarios so they can be read as a user story

Answer: A, B, D

36. Cucumber Reporting Options


Question:
Which reporting plugins are available in Cucumber for generating detailed test
reports? (Select all that apply)

A. HTML

B. XML

C. JSON

D. SQL

Answer: A, B, C

Cucumber MCQs 14
37. Scenario Outline and Parameterization in Gherkin
Match the Following:
Match the concept with its usage in Cucumber.

Concept Usage

Scenario Outline A. Reuse the same scenario with multiple data sets

Examples Table B. Holds different sets of parameters for Scenario Outline steps

Parameterization C. Allows dynamic values in scenarios to cover more test cases

Answer:

Scenario Outline - A

Examples Table - B

Parameterization - C

38. Real-World Scenario of Step Reusability


Question:

Your team wants to reuse step definitions across multiple features. Which
strategies support this goal? (Select all that apply)

A. Define steps in a separate library for common actions

B. Copy step definitions into each new feature file

C. Use generic step definitions with parameterization

D. Define all steps in a single file for easy access

Answer: A, C

39. Collaborating in BDD with Non-Technical Stakeholders


Question:
Which of the following are effective practices for collaborating with non-technical
stakeholders in a BDD project? (Select all that apply)

A. Share feature files written in Gherkin for review

Cucumber MCQs 15
B. Use technical terminology in scenarios for precision

C. Conduct regular review meetings for feature file updates

D. Keep scenarios simple and focused on the end-user perspective

Answer: A, C, D

40. Cucumber Scenario Execution Order


Question:

Which of the following control the order in which Cucumber scenarios are
executed? (Select one)

A. Scenarios are always run alphabetically by name

B. Scenarios run in the order they appear in the feature file

C. Scenarios execute in a random order each run

D. Order is controlled by the tag used in @CucumberOptions

Answer: B

41. Handling Flaky Tests in Cucumber


Question:
Which approaches help address flaky tests in Cucumber? (Select all that apply)

A. Increase timeouts for steps that rely on web page elements

B. Use Before hooks to set up necessary data consistently

C. Avoid using external dependencies in tests

D. Use assertions that wait for elements instead of immediate checks

Answer: A, B, D

42. Real-World Use of Hooks


Question:
Your manager asks you to ensure database records are deleted after test runs.
Which hook setup would you use? (Select one)

Cucumber MCQs 16
A. @BeforeAll

B. @After

C. @AfterAll

D. @Before

Answer: B

43. Troubleshooting Step Definition Conflicts


Question:
Which steps are useful for troubleshooting when multiple step definitions match a
single step? (Select all that apply)

A. Ensure all steps have unique expressions

B. Adjust regular expressions to prevent overlap

C. Remove unused step definitions from the project

D. Rely on dryRun to detect conflicting steps

Answer: A, B

44. Continuous Integration (CI) with Cucumber


Question:

Which of the following best describes the role of Cucumber in Continuous


Integration (CI)? (Select all that apply)

A. Automates behavior validation in the CI pipeline

B. Helps run multiple environments in CI by using tags

C. Creates executable documentation for developers

D. Provides immediate feedback on feature completion

Answer: A, B, C, D

6. Data-Driven Testing in Cucumber


Question 45:

Cucumber MCQs 17
Which of the following best describe the role of the Scenario Outline in data-driven
testing? (Select all that apply)

A. Reuses a scenario with different data sets from an Examples table

B. Allows testing with dynamic data without altering the scenario structure

C. Is only used for non-functional testing

D. Supports multiple test cases in a single scenario by parameterizing data

Answer: A, B, D

Question 46:
When using DataTables in Cucumber, which of the following are true? (Select all
that apply)

A. DataTables allow passing multiple rows and columns of data to step


definitions

B. DataTables only support string values and must be manually converted for
numbers

C. Transposing DataTables can help convert data to row-column format for


easier handling

D. DataTables are primarily used in unit testing rather than functional testing

Answer: A, C

Question 47:
In which of the following scenarios would you use Scenario Outline and Examples in
real-world testing? (Select one)

A. For tests where each scenario is independent and doesn’t need


parameterized data

B. When testing a login feature with multiple sets of user credentials

C. When validating UI component layout for static elements

D. When configuring multiple feature files in a single test suite

Answer: B

Cucumber MCQs 18
7. Cucumber with Selenium
Question 48:
Which of the following describes the purpose of integrating Cucumber with
Selenium? (Select all that apply)

A. Enables UI test automation by simulating user interactions on a web page

B. Allows running Selenium tests without any configurations

C. Facilitates collaboration between technical and non-technical teams by


using Gherkin

D. Removes the need to define locators for UI elements

Answer: A, C

Question 49:

When writing Cucumber tests with Selenium, what is the primary use of step
definitions? (Select one)

A. To describe test scenarios in Gherkin format

B. To execute Gherkin steps by mapping them to Selenium WebDriver


commands

C. To set up TestNG configuration files for test execution

D. To create custom reports based on test results

Answer: B

Question 50:
Which of the following are best practices when locating web elements for
Cucumber tests in Selenium? (Select all that apply)

A. Use reliable locators like id or name whenever possible

B. Prefer CSS Selectors or XPath for dynamic elements

C. Always use absolute XPaths to ensure accuracy

D. Avoid depending on text-based locators for dynamic content

Answer: A, B, D

Cucumber MCQs 19
8. JUnit/TestNG Integration
Question 51:

Which statements are true when running Cucumber with JUnit? (Select all that
apply)

A. JUnit enables integration with @RunWith to execute Cucumber tests

B. JUnit is mandatory for running Cucumber with Selenium

C. JUnit provides assertions used in Cucumber step definitions

D. Cucumber test runners with JUnit support parallel execution

Answer: A, C

Question 52:
How does integrating TestNG with Cucumber differ from JUnit integration? (Select
one)

A. TestNG allows parameterization of tests without additional setup

B. TestNG offers enhanced configuration and dependency control for


Cucumber tests

C. TestNG does not support @DataProvider with Cucumber tests

D. TestNG is only compatible with JUnit 5+

Answer: B

Question 53:
What is the primary purpose of using JUnit/TestNG test runners with Cucumber in
a real-world application? (Select all that apply)

A. To configure, execute, and manage Cucumber tests with external libraries

B. To enable flexible test reporting and assertion handling

C. To run Cucumber tests alongside other test suites in a CI pipeline

D. To separate feature files from step definitions

Answer: A, B, C

Cucumber MCQs 20
9. Plugins and Reporting
Question 54:
Which of the following plugins are used to generate test reports in Cucumber?
(Select all that apply)

A. JSON

B. XML

C. HTML

D. YAML

Answer: A, B, C

Question 55:
Why would a team use third-party tools like ExtentReports with Cucumber?
(Select all that apply)

A. ExtentReports provides detailed graphical reports with enhanced insights

B. It automatically generates JSON and XML files for Cucumber tests

C. ExtentReports offers test-level reporting to track test execution over time

D. Integrates smoothly with CI/CD pipelines to provide reporting capabilities

Answer: A, C, D

Question 56:
Which of the following steps are necessary to configure report generation in
Cucumber? (Select all that apply)

A. Set up the plugin option in @CucumberOptions

B. Specify the output format as HTML, JSON, or XML for the report

C. Run tests in dryRun mode to generate report files without execution

D. Configure the output path for reports in the test runner

Answer: A, B, D

10. Common Cucumber Problems

Cucumber MCQs 21
Question 57:
What is the recommended solution for handling duplicate step definitions? (Select
all that apply)

A. Combine similar steps into a single generic step definition

B. Define all steps in a single file to avoid duplicate definitions

C. Use regular expressions or parameters to avoid exact matches

D. Remove any unused or outdated step definitions

Answer: A, C, D

Question 58:

If you encounter undefined or pending steps, what are potential troubleshooting


steps? (Select all that apply)

A. Ensure feature files are correctly mapped in the test runner

B. Check for typos or mismatches between Gherkin steps and step definitions

C. Always add @Before hooks to initialize all steps before tests run

D. Run Cucumber in dryRun mode to identify missing step mappings

Answer: A, B, D

Question 59:
Which of the following are best practices for writing maintainable BDD tests in
Cucumber? (Select all that apply)

A. Use descriptive and consistent language in Gherkin scenarios

B. Separate step definitions logically to avoid cross-feature dependencies

C. Use complex conditions in Gherkin to consolidate multiple scenarios

D. Avoid hardcoding data directly in Gherkin scenarios

Answer: A, B, D

Question 60:

Cucumber MCQs 22
When troubleshooting Gherkin errors, which of the following approaches are most
effective? (Select all that apply)

A. Ensure correct syntax and indentation in feature files

B. Use common terms and clear language in Gherkin steps

C. Add exception handling for undefined steps

D. Avoid using Gherkin keywords outside the Feature , Scenario , Given , When ,
and Then structure

Answer: A, B, D

6. Data-Driven Testing in Cucumber


Question 61:
Which statement is true about using Examples in a Scenario Outline ?

A. Each row in Examples runs the entire feature file

B. Only one Example can be defined in each Scenario Outline

C. Examples enable parameterization of a single scenario multiple times

D. Examples are only used for UI tests

Answer: C

Question 62:
Which of these DataTable usages would be suitable for passing complex data in
step definitions?

A. DataTable.asList() for single column data

B. DataTable.asMap() for key-value pairs

C. DataTable.asTransposedMap() for hierarchical data

D. DataTable.asGrid() for detailed matrix-type data

Answer: B

Question 63:
When would you transpose a DataTable in Cucumber?

Cucumber MCQs 23
A. To allow DataTables to be used across multiple step definitions

B. When switching rows and columns for easier mapping in step definitions

C. To generate multiple scenarios in one feature file

D. To directly convert all DataTables to JSON format

Answer: B

Question 64:
What advantage does parameterizing a DataTable provide in Cucumber?

A. It allows dynamic configuration of the test runner

B. It enables detailed reporting

C. It allows more flexible and reusable steps across scenarios

D. It ensures backward compatibility

Answer: C

7. Cucumber with Selenium


Question 65:
Why might Page Object Model (POM) be advantageous in a Cucumber-Selenium
framework?

A. It encourages test data reusability

B. It eliminates the need for locators

C. It separates test scripts from the application structure, enhancing


maintainability

D. It creates dynamic scenarios automatically

Answer: C

Question 66:
Which of the following can affect the stability of Cucumber with Selenium tests?

A. Using consistent locators

Cucumber MCQs 24
B. Frequent UI changes

C. Avoiding waits between steps

D. Hardcoding wait times

Answer: B, C, D

Question 67:
In Cucumber-Selenium integration, where would you define browser-specific
configurations?

A. Directly in the feature files

B. Within each step definition

C. In a setup method outside Cucumber

D. Using configuration files managed outside Cucumber tests

Answer: D

Question 68:

How should actions be handled when writing UI tests with Selenium in Cucumber?

A. By directly manipulating locators in the feature file

B. By using Selenium actions within step definitions only

C. By hardcoding the flow of user actions in the feature file

D. By mapping Gherkin steps to Selenium actions through reusable step


definitions

Answer: D

8. JUnit/TestNG Integration
Question 69:
What annotation in JUnit helps run Cucumber tests as part of a suite?

A. @CucumberOptions

B. @TestSuite

Cucumber MCQs 25
C. @RunWith

D. @FeatureOptions

Answer: C

Question 70:

When configuring TestNG for Cucumber, which of the following would allow
custom setup before test execution?

A. @BeforeSuite

B. @BeforeMethod

C. @AfterTest

D. @AfterClass

Answer: A

Question 71:
What configuration file is essential when using TestNG with Cucumber?

A. testng.xml

B. cucumber.json

C. junit.xml

D. cucumber-test.xml

Answer: A

Question 72:
How does the TestNG integration differ from JUnit in a Cucumber project?

A. TestNG supports configuration in testng.xml for more detailed suite setups

B. JUnit provides a wider range of reporting plugins for Cucumber

C. TestNG requires additional plugins for integration

D. TestNG only supports single-threaded execution

Answer: A

Cucumber MCQs 26
9. Plugins and Reporting
Question 73:
Which of the following configuration options in @CucumberOptions enables report
generation?

A. tags

B. glue

C. plugin

D. dryRun

Answer: C

Question 74:
Why might a JSON report be beneficial in a CI/CD pipeline?

A. It provides detailed output for HTML viewers

B. It is compatible with most automation dashboards and integrates with third-


party tools

C. It only works for data-driven test reports

D. It is only suitable for local reporting

Answer: B

Question 75:

Which tool allows enhanced reporting when used with Cucumber?

A. Allure

B. XML Report Generator

C. JUnit Viewer

D. JSON Viewer

Answer: A

Question 76:
In a Cucumber project, what benefit does HTML reporting provide?

Cucumber MCQs 27
A. It formats results for SQL databases

B. It provides an easily readable visual report of test results

C. It creates standalone XML reports for automation purposes

D. It consolidates test data into a grid format

Answer: B

Question 77:
What steps are required to configure a report using ExtentReports in Cucumber?

A. Add ExtentReports as a dependency

B. Modify @CucumberOptions to output Extent reports

C. Configure ExtentReports in the test runner

D. Use Gherkin to directly output Extent reports

Answer: A, C

10. Common Cucumber Problems


Question 78:
What is a recommended approach when you encounter an undefined step in
Cucumber?

A. Define the missing step in an existing step definition file

B. Ignore the error and proceed with test execution

C. Modify the feature file to include default definitions

D. Use hooks to create definitions automatically

Answer: A

Question 79:
When should you use a Before hook in Cucumber?

A. For setting up browser configurations in each scenario

B. Only in conjunction with Scenario Outline

Cucumber MCQs 28
C. To map test data directly in the step definition

D. For combining multiple feature files

Answer: A

Question 80:
Which of the following can cause Pending Steps errors in Cucumber?

A. Steps without matching step definitions

B. Use of unsupported characters in Gherkin syntax

C. Including Examples in a Scenario without Scenario Outline

D. Creating step definitions in separate files

Answer: A

Question 81:
What troubleshooting step can help when Gherkin errors appear in your feature
files?

A. Verify correct indentation and syntax in the feature file

B. Check for consistency in @Before and @After hook usage

C. Re-run tests in dry mode to ignore failures

D. Run the feature file as a standalone module

Answer: A

Question 82:
Which is the recommended practice for managing duplicate step definitions?

A. Create separate step definition files for each feature

B. Use common keywords and avoid unnecessary steps

C. Consolidate similar steps and parameterize where possible

D. Keep each step definition distinct even if redundant

Answer: C

Cucumber MCQs 29
Question 83:
How can Tagged Hooks optimize your Cucumber tests?

A. By executing certain steps based on tag filters

B. By organizing tests by feature type

C. By running multiple test suites simultaneously

D. By marking steps for external reporting

Answer: A

Question 84:
If Gherkin is giving syntax errors despite correct step definitions, what could be
the problem?

A. Incorrect @CucumberOptions configurations

B. Mismatched Gherkin keywords

C. Outdated plugin integration

D. Unclosed tags in step definitions

Answer: B

Question 85:

Which best practices in BDD testing can reduce future maintenance issues in
Cucumber?

A. Avoid hardcoding data in Gherkin scenarios

B. Regularly refactor scenarios to match feature changes

C. Use complex expressions within Gherkin steps

D. Simplify test cases to ensure minimal dependencies

Answer: A, B, D

Cucumber MCQs 30

You might also like