Automation Testing by using Cucumber Tool and Selenium and Benefits of Behavior Driven Development.

Automation testing-blog-img

What is Cucumber?

A cucumber is a tool that is based on the Behavior Driven Development(BDD) framework. There are other tools that support BDD(Behavior Driven Development) for example JBehave. This Behavior Driven Development(BDD) is an extension of Test-Driven Development. It is one of the testing approaches. By using Gherkin language it explains the behavior of the application. Both selenium and cucumber are used to perform acceptance testing for the web application. At the beginning cucumber was implemented in Ruby later it extended to Java framework.

Cucumber can be used in combination with Selenium, Watir, Capybara and so on. It supports different languages like PHP, Python, Perl, Net,etc., It Does not support composite steps. Cucumber does not contain any standard documentation. It contains a better formatting flexibility, built in reports. Here are some cucumber features.

  1. Cucumber Hooks.
  2. Cucumber annotations.
  3. Cucumber Background.
  4. Cucumber tags.
  5. Cucumber Data tables.
  6. Cucumber multi scenarios.

These are some features of Cucumber. There is a possibility to execute the Junit test case which was written in Cucumber by using TestNG. But by following the below conditions.They are:

  1. Needs to add the dependencies to the Maven project.
  2. Needs to extent the class in the runner class AbstractTestNGCucumberTests package runner.
  3. And the third point is wherever the runner class exits convert the maven project and add the package. And the Cumber contains three different files. They are
  • Feature file.
  • Stepdef file.
  • Runner file.

Feature file:

In the Feature file, the feature is written that is to be tested in Gherkin format. There is an ability to even run the feature file to execute the test scripts which were written in the StepDef file.

Stepdef file:

In the StepDef file each sentence of the featured file can be further implemented.

Runner file:

In this Runner file the actual script is executed which was written over the StepDef file by referring to the Feature file. Along with this, it contains many other options like customization, reporting, execution, selective, etc.

What is Selenium?

For the functional testing of the web application selenium automation tool is used. It supports different languages like java, ruby, python, c#, etc. It is not just a tool but it is a suite of software. Some tools mentioned below.

  • Selenium WebDriver.
  • Selenium Integrated Development Environment (IDE).
  • Selenium Remote Control (RC).
  • Selenium Grid.

Benefits of Behavior Driven Development(BDD):

  1. Fill the gap between the technical team and business holders through a common platform.
  2. Include the people from the client who even can write the scenarios.
  3. Since the scenarios are easy to understand it will be easier to divide it into tasks, subtasks in a logical manner.
  4. Instead of writing the code based on the developer’s understanding, the developers write the code based on the scenarios written in the BDD(Behavior Driven Deployment) framework.
  5. Because of the simplicity of the code and the documentation it is easy to understand for the newly joined.
  6. BDD (Behavior Driven Deployment) helps the unit-level test cases and also helps in validating the scenario.

About the Author

You may also like these