Cucumber MCQs
Cucumber MCQs
1. Introduction to Cucumber
Question:
Which of the following are true advantages of using Cucumber in BDD? (Select all
that apply)
Answer: B, D, E
Role Contribution
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)
Answer: B, C
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)
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
Answer:
@smoke - B
@regression - C
@UAT - A
@integration - D
7. Step Definitions
Question:
Answer: A, C, D
Cucumber MCQs 3
Question:
In Cucumber, which of the following are examples of parameterization for
reusable step definitions? (Select all that apply)
Answer: B, C
9. Hooks in Cucumber
Question:
Which of the following are correct usages of hooks in Cucumber? (Select all that
apply)
Answer: A, B
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)
Answer: A, C
What are the recommended practices for naming feature files in a Cucumber
project? (Select all that apply)
Answer: A, C
Scenario Outline B. Requires Examples table for multiple test data inputs
Cucumber MCQs 5
Answer:
Scenario - A
Scenario Outline - B
Which of the following correctly describes Tagged Hooks in Cucumber? (Select all
that apply)
Answer: A, C
Answer: B
Cucumber MCQs 6
B. Business analysts
C. QA engineers
D. Product owners
Answer: B, C, D
Answer: A, C, D
Keyword Use
Answer:
Given - A
When - B
Then - C
Cucumber MCQs 7
And/But - D
Answer: A, C, D
Answer: B, C, D
A. @BeforeAll
B. @Before
Cucumber MCQs 8
C. @After
D. @BeforeScenario
Answer: B
Which statements are true about writing effective Cucumber feature files? (Select
all that apply)
Answer: A, C, D
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)
Answer: B
Answer: A, B, C
Cucumber MCQs 10
D. Automatically reflects changes in step definitions with Gherkin update
Answer: A, C
Which of the following correctly describe the purpose of the plugin option in
@CucumberOptions ? (Select all that apply)
Answer: A, D
Answer: A, B, D
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
Answer: A, B, D
B. Check that step definitions match the wording and capitalization of Gherkin
steps
Answer: A, B, D
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.
@BeforeAll D. Executes once before all tests run for global setup
Answer:
@Before - A
@After - B
Tagged Hooks - C
@BeforeAll - D
Answer: A, D
Cucumber MCQs 13
Which practices improve the reusability of step definitions in Cucumber? (Select
all that apply)
Answer: A, B, D
Answer: A, B, D
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
Answer:
Scenario Outline - A
Examples Table - B
Parameterization - C
Your team wants to reuse step definitions across multiple features. Which
strategies support this goal? (Select all that apply)
Answer: A, C
Cucumber MCQs 15
B. Use technical terminology in scenarios for precision
Answer: A, C, D
Which of the following control the order in which Cucumber scenarios are
executed? (Select one)
Answer: B
Answer: A, B, D
Cucumber MCQs 16
A. @BeforeAll
B. @After
C. @AfterAll
D. @Before
Answer: B
Answer: A, B
Answer: A, B, C, D
Cucumber MCQs 17
Which of the following best describe the role of the Scenario Outline in data-driven
testing? (Select all that apply)
B. Allows testing with dynamic data without altering the scenario structure
Answer: A, B, D
Question 46:
When using DataTables in Cucumber, which of the following are true? (Select all
that apply)
B. DataTables only support string values and must be manually converted for
numbers
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)
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)
Answer: A, C
Question 49:
When writing Cucumber tests with Selenium, what is the primary use of step
definitions? (Select one)
Answer: B
Question 50:
Which of the following are best practices when locating web elements for
Cucumber tests in Selenium? (Select all that apply)
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)
Answer: A, C
Question 52:
How does integrating TestNG with Cucumber differ from JUnit integration? (Select
one)
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)
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)
Answer: A, C, D
Question 56:
Which of the following steps are necessary to configure report generation in
Cucumber? (Select all that apply)
B. Specify the output format as HTML, JSON, or XML for the report
Answer: A, B, D
Cucumber MCQs 21
Question 57:
What is the recommended solution for handling duplicate step definitions? (Select
all that apply)
Answer: A, C, D
Question 58:
B. Check for typos or mismatches between Gherkin steps and step definitions
C. Always add @Before hooks to initialize all steps before tests run
Answer: A, B, D
Question 59:
Which of the following are best practices for writing maintainable BDD tests in
Cucumber? (Select all that apply)
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)
D. Avoid using Gherkin keywords outside the Feature , Scenario , Given , When ,
and Then structure
Answer: A, B, D
Answer: C
Question 62:
Which of these DataTable usages would be suitable for passing complex data in
step definitions?
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
Answer: B
Question 64:
What advantage does parameterizing a DataTable provide in Cucumber?
Answer: C
Answer: C
Question 66:
Which of the following can affect the stability of Cucumber with Selenium tests?
Cucumber MCQs 24
B. Frequent UI changes
Answer: B, C, D
Question 67:
In Cucumber-Selenium integration, where would you define browser-specific
configurations?
Answer: D
Question 68:
How should actions be handled when writing UI tests with Selenium in Cucumber?
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?
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?
Answer: B
Question 75:
A. Allure
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
Answer: B
Question 77:
What steps are required to configure a report using ExtentReports in Cucumber?
Answer: A, C
Answer: A
Question 79:
When should you use a Before hook in Cucumber?
Cucumber MCQs 28
C. To map test data directly in the step definition
Answer: A
Question 80:
Which of the following can cause Pending Steps errors in Cucumber?
Answer: A
Question 81:
What troubleshooting step can help when Gherkin errors appear in your feature
files?
Answer: A
Question 82:
Which is the recommended practice for managing duplicate step definitions?
Answer: C
Cucumber MCQs 29
Question 83:
How can Tagged Hooks optimize your Cucumber tests?
Answer: A
Question 84:
If Gherkin is giving syntax errors despite correct step definitions, what could be
the problem?
Answer: B
Question 85:
Which best practices in BDD testing can reduce future maintenance issues in
Cucumber?
Answer: A, B, D
Cucumber MCQs 30