HOME
Are you familiar with Cucumber and want to test your understanding? This post contains 25 useful Cucumber multiple-choice questions (quiz) to self-test your knowledge of Cucumber.
Cucumber Multiple Choice Questions – MCQ1
1. What is the purpose of Cucumber?
Select the best answer
- To write tests in a human-readable format
- To automate software testing
- To improve software quality
- All of the above
Answer
2. The __ programming language is used for the creation of these executable test scripts.
Choose one option
- Gherkin
- Gerkin
- Gerin
- Gerkn
Answer
3. Which of the following is an example of a Cucumber data table?
Choose one option
- A table of test results
- A table of test requirements
- A table of input parameters
- A table of test scenarios
Answer
4. Which of the following is an example of a Cucumber scenario outline?
Choose one option
- Scenario: Login with valid credentials
- Scenario Outline: Login with invalid credentials
- scenario: Add item to shopping cart
- scenario outline: Search for product
Answer
5. Which option check if all the steps have the step definition before execute?
Choose one option
- monochrome
- dryRun
- strict
- validate
Answer
6. Which of the following is a Cucumber option that can be used to specify the path to the feature files?
- –tags
- –strict
- –format
- –glue
Answer
7. Which of the following is a Cucumber option that can be used to enforce stricter syntax checking?
- –tags
- –strict
- –name
- –format
Answer
8. Which of the following is a Maven command that can be used to run scenarios that have been tagged as “regression” tests in Cucumber?
mvn test -Dcucumber.filter.tags="@regression"
mvn test -Dcucumber.tags="@regression"
mvn test -cucumber.filter.tags="@regression"
Answer
9. Which of the following is a Maven command that can be used to run a feature file in Cucumber
Choose one option
mvn test -Dcucumber.features="src/test/resources/features/Login.feature"
mvn test -Dcucumber.features="src/test/resources/features/Login"
mvn test -cucumber.feature="src/test/resources/features/Login.feature"
Answer
10. Which of the following is a Maven command that can be used to pass the glue code in Cucumber
Choose one option
mvn test -Dcucumber.gluecode="com.example.stepdefinitions"
mvn test -Dcucumber.glue_code="com.example.stepdefinitions"
mvn test -Dcucumber.glue="com.example.stepdefinitions"
Answer
11. Which of the following is a Maven command that can be used to generate Cucumber Report
Choose one option
mvn test -Dcucumber.plugin="html:target/cucumber-reports/cucumberReport.html"
mvn test -cucumber.plugin="html:target/cucumber-reports/cucumberReport.html"
mvn test -Dcucumber.plugins="target/cucumber-reports/cucumberReport"
Answer
12. Tags that are placed above a Scenario Outline will be inherited by Examples
Choose one option
- True
- False
Answer
13. Below is a valid example of Scenario Outline
Scenario Outline: Login to Home Page
Given user is logged in
When user clicks <link>
Then user will be logged out
@mobile
Examples:
| link |
| mobile logout |
@desktop
Examples:
| link |
| desktop logout |
Choose one option
- True
- False
Answer
14. Tags that are placed above a __ will be inherited by Scenario, Scenario Outline, or Examples.
Choose one option
- Scenario Outline
- Feature
- Background
- None
Answer
15. Select a valid example of running multiple parameters in the Cucumber
mvn test -Dcucumber.features="src/test/resources/LoginPage.feature" -Dcucumber.filter.tags="@ValidCredentials"
mvn test -Dcucumber.features="src/test/resources/LoginPage.feature" and -Dcucumber.filter.tags="@ValidCredentials"
mvn test -Dcucumber.features="src/test/resources/LoginPage.feature" or -Dcucumber.filter.tags="@ValidCredentials"
Answer
16. The __
can be used to provide additional configuration to the runner.
Choose one option
- @CucumberOptions
- @Cucumber
- @Options
- None
Answer
17. Which of the following is an example of Cucumber TestRunner?
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith
@CucumberOptions(plugin = {"pretty"})
public class RunCucumberTest {
}
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@CucumberOptions(plugin = {"pretty"})
public class RunCucumberTest {
}
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"pretty"})
public class RunCucumberTest {
}
Answer
18. Can we run the tests in Cucumber parallelly?
Choose one option
- Yes
- No
Answer
19. How to print console output from Cucumber in a readable format?
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(monochrome=true)
public class RunCucumberTest {
}
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"pretty", "summary"})
public class RunCucumberTest {
}
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(snippets = SnippetType.CAMELCASE)
public class RunCucumberTest {
}
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(dryRun=true)
public class RunCucumberTest {
}
Answer
20. Which of the following is an example of a Cucumber plugin?
mvn test -Dcucumber.tags="@smoke and @regression"
Choose one option
- Run all the scenarios in the feature file
- Run the scenario tagged with smoke
- Run the scenario tagged with regression
- Run the scenario tagged with both smoke and regression
Answer
21. What are the different types of hooks
Choose one option
- Scenario Hook
- Step Hook
- Conditional Hook
- All of the above
Answer
22. Can we integrate Cucumber with TestNG?
Choose one option
- Yes
- No
Answer
23. Can we integrate Cucumber with JUnit?
Choose one option
- Yes
- No
Answer
24. Can we execute the Cucumber tests in CI/CD like GitHub pipeline, Jenkins and so
Choose one option
- Yes
- No
Answer
25. Below is the valid syntax for the Test Runner class?
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
@CucumberOptions(features = "src/test/resources/Features")
public class CucumberRunnerTests extends AbstractTestNGCucumberTests {
}
Choose one option
- Yes
- No
Answer
====================================================================