TDD, BDD, Cucumber & Selenium

Sachin Joshi
3 min readMay 4, 2022

--

In this topic, we are going to understand TDD, BDD, Cucumber & how we can use them with Selenium by Q&A session.

1. what is TDD(Test Driven Development) & what are the different processes used in TDD?

TDD stands for Test-Driven Development.

Even though TDD is a development technique, it can also be used for automation testing.

In TDD, Developer has to write their test cases before writing the code which can be considered as disadvantages from Development point of view. But, TDD helps developers to achieve high test coverage approx 90–100%.

Following are simple 6 processes used by TDD:

  1. Write the test case at First
  2. Execute all the test cases
  3. Now, Develop the code for the test case written
  4. Execute test cases again
  5. Refactor the code
  6. Repeat steps 1- 5 to create new test cases

2. What is main purpose of Behavior Driven Development (BDD) framework?

BDD framework purpose is to make various project roles such as Business Analysts, Quality Assurance, Developers, etc., understand the application without diving deep into the technical aspects.

3. what is difference between TDD & BDD ?

4. What is Scenario Outline in Cucumber?

In Cucumber, a Scenario outline is used as a parameter of scenarios.

It is useful when the same scenario needs to be executed for multiple sets of data and the test steps remain the same.

Scenario Outline must be followed by the keyword ‘Examples’, which specify the set of values for each parameter.

5. What do you mean by step definition in Cucumber?

A step definition is nothing but the actual code implementation of the feature mentioned in the feature file.

6. Tell me difference between Selenium and Cucumber?

  • Selenium is a web browser automation tool for web apps and Cucumber is an automation tool for BDD that can be used with Selenium/Appium.
  • Selenium is used to automate UI test cases and Cucumber is used for acceptance testing.
  • Selenium is preferred by technical teams like SDETs or programmers and Cucumber is mostly preferred by non-technical teams such as business stakeholders or testers.
  • Selenium may or may not have implementation of Cucumber but Cucumber is always depends on Selenium or Appium for step-definition implementation.

7. What is TestRunner class in Cucumber ? Explain with example.

TestRunner class provides the link between the feature file and the step definition file.

The TestRunner class is generally an empty class with no class definition.

for Example:

8. Which build management tools can be integrated with Cucumber?

  • Gradle
  • Maven

9. How will you integrate Cucumber with Selenium WebDriver?

We need below list of JAR files to be downloaded for using Cucumber with Selenium web driver (always use the latest versions available):

  • cucumber-core-1.2.2.jar
  • cucumber-java-1.2.2.jar
  • cucumber-junit-1.2.2.jar
  • cucumber-jvm-deps-1.0.3.jar
  • cucumber-reporting-0.1.0.jar
  • gherkin-2.12.2.jar

10. What are the basic requirements to run Cucumber Web test cases?

  1. The compiler and the development kit for the programming language we will be using.

Example: JDK and JRE for using Java as our programming language.

2. An IDE (Integrated Development Environment) wherein we can write our code.

Example: Eclipse.

3. Build tools so as to do tasks such as compiling code, packaging code to a jar, creating source code.

Example: Maven, Gradle.

Hope you have liked the topic !

Keep Learning !!!

hit the follow button for more topics on Java, RestAssured, GraphQL, Selenium, JavaScript, JUnit, Jenkins, GitHub Actions, WebUI, SOAP & VBScripts

https://medium.com/@sachinjoshi12687

Also, DM me if you want me to add new topic of your choice urgently.

--

--

Sachin Joshi

follow me for more topics on Java, RestAssured, GraphQL, Selenium, JavaScript, JUnit, Jenkins, GitHub Actions, WebUI, SOAP & VBScripts