Cucumber Tool

Cucumber tool is a software tool which supports Behaviour Driven Development (BDD), very much suitable for Agile teams. It is supported by SmartBear. It expects, the software behaviors to be written in common and simple language, the customer can understand. The development team works in collaboration with stakeholder team. 

BDD is Behaviour Driven Development is more of a user perspective and based on the behaviour of the system. 


Consider an example of creating the funds  transfer module for an net banking application. We have multiple ways to create this application and test it. They are:

  1. The fund transfer should take place if there is enough balance account in source account.
  2. Fund transfer must  take place if the destination account details are correct.
  3. Fund transfer should take place if transaction password or authentication entered by the user is correct.
  4. Fund transfer should always take place if the bank is NOT holiday.

The test scenario becomes more detailed and complex, as we consider more features like transfer amount X for an interval Z days and it should stop transfer when total amount reaches Y.

The general tendency of developers is to develop features and write code later. The developer will continue testing at program levels till release to testing team.  At that point he will do quick testing but ineffective testing. In order to overcome this issue BDD was introduced. 

Cucumber is a tool which supports behaviour driven development. It offers an understandable format to write test cases. Here the users write scenarios or acceptance tests which describes the behaviour of the system from the customer’s perspective. For the review, of application by the product owners before the developers write their code. Cucumber uses ruby programming language

Integration of Selenium and Cucumber:

Selenium is a famous tool in the IT industry most of the IT companies use selenium and want to integrate with cucumber. Cucumber acts as bridge between the software engineer and business analyst. In behavior driven development, before the developer develops a code the user writes  test scenarios as per the behavior of the system from customer’s perspective. With a simplicity and naïve view of scenarios cucumber works beautifully. 

For example:

Given a login page, when entered valid credentials user should see account.

Three salient features of Cucumber are:

1. Feature files: 

These are essential parts of cucumber and are used to write test automation steps or acceptance tests. This will be used for live document. If we can consider the login functionality feature file. There scenario is considered as login functionality, in which a user navigates through a login functionality. When the user logs in by giving user name and password, either the login should be successful or it should throw some error message. For this, we can verify by cucumber test.

2. Feature: 

Feature gives the information about high-level business functionality and its purpose of application under test. Everybody should understand the intent of feature file by reading the first feature step.

3. Scenario: 

Usually the scenarios represents the particular functionality which will be under test. Each scenario follows certain format called Gherkin files.

  1. Given: This specifies the pre-conditions. It is basically known as state.
  1. When: This is used when some action is performed. One of the example, when the user tries to log in using username and password which is considered as action. 
  1. Then: In this section, the expected result or outcome is placed here. For example, for verifying the login navigation page.
  1. Background: Whenever the step is required, those particular steps are placed in the background.
  1. And: This format is used to combine two or more actions.

Advantages of Cucumber tool:

The advantages of cucumber tool are:

  1. It is helpful to involve business stakeholders who really cant read the code.
  2. Cucumber testing focuses on the end-user experience.
  3. Style of writing tests permits easier reuse of code in the test
  4. It has quick and easy execution and setup.
  5. Efficient tool for testing.
  6. Plugin in cucumber works very faster.
  7. Its open-source free software supports other languages.

Facebook Comments

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button