Site icon Letzdotesting

Top 30 Cucumber Interview Questions & Answers

Top 30 Cucumber Interview Questions & Answers

1. Full form of BDD

BDD stands for Behavior Driven Development

2. Full form of TDD

TDD stands for Test Driven Development

3. What is the difference between BDD and TDD?

Behavior centered development processTest centered development process
BDD tests are written in readable format using Given-When-Then stepsTDD tests are written using programming languages like Ruby, JAVA etc
BDD tests are readable by non-programmersTDD tests are difficult to read by non-programmers

4. Name any 3 popular BDD testing tools

5. What is the difference between cucumber, JBehave, and Specflow?

6. What is Cucumber?

Cucumber is a testing framework written in BDD style. Cucumber lets us define the system behavior from user’s perspective in plain English text called Gherkin. Cucumber by itself is written in Ruby programming language but it can be used to test the code written in other programming languages like JAVA, .NET, Groovy etc.

7. What are the advantages of Cucumber?

8. What are the two files required to run a cucumber test?

9. What is a feature file?

Feature file is an entry point of Cucumber execution. Cucumber scenarios are written inside the feature file using a plain-text language called Gherkin. It can contain a scenario or multiple scenarios. All the acceptance tests are written in feature file using Given-When-Then statements.

10. What is the file extension of feature file?

.feature is the extension of feature file. Example, “Test.feature” is a feature file name.

11. What is the language used to write a scenario in feature file?

Gherkin is a plain-text language used to write cucumber scenario in the feature file. Gherkin is a business readable, domain-specific language used to describe the behavior of software application from user’s perspective so that its easy for non-programmers to read and collaborate.

12. What is the two main purpose of using Gherkin?

13. What are the keywords used in Feature file?

14. Is it mandatory to use Given, When, Then keywords while writing scenario?

No.   can also be used to write steps in the feature file.

15. What is the difference between Given, When, Then steps in feature file?

16. Explain Scenario Outline in feature file

Scenario Outline keyword in feature file is used to execute scenarios multiple times using a different set of test data. Multiple sets of test data are provided by using ‘Examples’ in a tabular structure separated by pipes (| |)

Example Scenario Outline below:

17. Explain background in feature file

Steps written under the Background keyword are executed before every scenario.

For example: If you want to execute the same steps for every scenario like login to the website, you just write those common steps under the background keyword. While executing every scenario, steps written under background will be executed first.

18. How to comment a line in Feature file?

# is used to comment a line in feature file

19. What is a Step definition file?

Step definitions file has the actual code implementation of the scenario step.

Feature file

Step definition file 

20. Write an example BDD test scenario

21. Explain Cucumber Tags

Cucumber tags are used to organize scenarios in your feature file. You can have as many tags as you like before a scenario or feature. @ is used to represent tags. Example: @regression, @sprint5, @EndtoEnd

Tags are used to

22. Cucumber Tags are case sensitive. True or False?  True

23. Name any two testing framework that can be integrated with Cucumber?

24. Name any two build management tools that can be integrated with Cucumber?

25. What software do you need to run cucumber in JAVA?

26. How does a JUnit Test Runner class look like? 

27. What is @CucumberOptions in test runner? List the properties of @CucumberOptions

@CucumberOptions are used to set specific properties for your cucumber test.

Properties are,

28. Name any advanced framework design that can be used with Cucumber?

29. Selenium can be integrated with Cucumber. True or False?  True

30. Explain Cucumber Hooks

Cucumber Hooks are blocks of code that can be used to run before and after the scenarios using @before and @after methods. It helps us eliminates the redundant code steps that we write for every scenario and also manages our code workflow.

Note: @After will be executed even though the scenario is failed. @Before will be executed before ‘Background’ steps in the feature file.

Thanks for reading 🙂 All the Best!

Suggested Readings : Top 40 Selenium Webdriver Interview Questions & Answers

Know anyone who is preparing for Cucumber or BDD Interview?  Help your friends by sharing this article on Facebook, Twitter, or Google Plus.

Exit mobile version