What is Cucumber and How to Work With Cucumber?

Spread the love
  • 29
  • 34
  • 28
  • 35
  • 12

Setup Cucumber and More Details On Cucumber

A short introduction of BDD

BDD (Behavior driven development) is an evolution in the thinking of test driven development (TDD) and Acceptance Test Driven development(ATDD) Planning. Test automation team usually take reference from requirement documents and automate in similar fashion to how the developer develop the application. It creates ambiguity between how test and development team interprete the requirements. On top of it automation is done after the development is completed.

In Cucumber driven testing the gherkins, the syntax is the acceptance criteria and it becomes the required documentation for both development and testing team.

A Unit test checks if developers are building the thing right and an acceptance test is to check if the developers are building the right things. BDD aims to help focus development on the delivery of prioritized, verifiable, business value by providing a common vocabulary (ubiquitous language) that spans the divide between Business and Technology.

A language structured around the domain model and used by all team members to connect all activities of the team with the software. Establishing the goals of different stakeholders requires a vision to be implemented. Drawing out features that will achieve those goals using feature injection. Involving stakeholders in the implementation process (Acceptance criteria, features, etc) using examples to describe the behaviors of the application, or units of code. Automating those examples to provide quick feedback and regression testing.

Setup Cucumber and More Details On Cucumber:

Cucumber is a BDD(Business-driven development) tool that runs acceptance testing. It reads plain text descriptions of the application features with examples and scenarios. later using cucumber they can be converted to automation. It is an easy interface between developers, testers and business people. Many times it is seen, business personnel who does not code or having little knowledge of coding prefers to do manual testing instead of automation testing. That makes acceptance testing slower.

To make it speedy Cucumber gives an easy to write and coding interface. It is an iterative development and testing process where tests are written before real development of code of the real application. So in the initial phase, all tests are supposed to be failed but slowly, when developers start implementing the features, tests start passing.BDD is an extension of TDD. Cucumber or JBehave acts as a bridge between Business and Technical language.
Here is a nice link on BDD- https://www.atlassian.com/blog/software-teams/making-the-shift-to-behavior-driven-development
Here is another one-

The overall cucumber takes a big effort to ensure the tests can be read and written by stakeholders themselves. This feature file written in Gherkin is the signed-off document form the stakeholders to the development and testing team.

Cucumber workflow
Cucumber workflow

What is objectives of using cucumber in BDD?

  1. Validate if the right system is being built.
  2. Validate if business,users,customer point of view are captured.
  3. Validate if the correct elaborative (with example) document is present about what system should do.
  4. Validate if the teams have the shared understanding of what is being built.
  5. Validate if the definition of done is achieved.

The expected output of using cucumber in BDD?

  1. The confirmation of building the system correctly.
  2. Living documentation(once automated),no need to maintain long time consuming documentation.
  3. Reduce the volatile ness and cuts down the cross discussion understanding mismatch.

Who are the primary Audience?

  • Product Owner(PO)
  • Business Owner(BO)
  • Business Analysts(BA)
  • Subject Matter Experts(SME)
  • Testers
  • Developers
  1. Cucumber framework helps the business stakeholders to write proper acceptance testing testcases.
  2. It reduces communication gaps between domain experts and development as well as testing teams
  3. Under the hood step definition translates business facing language(Gherkins) to actual language(java)

How BDD viz Cucumber works?

Cucumber translates the business language to pure language.

Cucumber work principle
Cucumber work principle
  • It is written in plain text.
  • It is understood by the business,developers and testers.
  • It targets the business requirements.
  • Significant proportion of functional specifications are written as user stories.
  • It provides just enough living document.

Where to Start?

  • BDD cucumber starts with a conversation between stakeholders.
  • It is goal is to determine the features and derive acceptance criteria.
  • It defines the definition of done.

Core principles of Cucumber

  1. Developers write the test before the code.
  2. Developers will not touch or code anything other than covering the failing testcases.
  3. The testcase will cover the acceptance criteria for an user story.
  4. There should be a joint effort to write the testcases. Developers, testers and customers should join in the writing process of the testcase development
  5. These testcases are behavioral or high level tests but not unit tests.

Cucumber is governed by cucumber-Gherkin language.

Advantages of using Cucumber in BDD :

  • Unit tests are code driven and actually produces code. Driven by Business value.
  • Business drives the development via testing process that focuses on behavior rather than developed code.
  • Refactoring improves the code and stability of the application
  • Test first approach reduces the cost of bugs
  • Simple Given,When and Then approach,so all stakeholders can design the feature of the application.It provides an easy collaboration between stakeholders,business analyst,QA team and developers.
  • Free style English writing focuses on user experience. Easy to understand.
  • Quick,Easy to setup and executable.
  • Efficient tool for testing.
  • User can provide example to clarify requirements.
  • Ensures automated code coverage.
  • Provides valuable tests.
  • It relies on shared understanding by discussing examples. Hence all team members know what they are actually trying to achieve.


  • Tests become part of the maintenance overhead
  • Tests needs to be rewritten when requirements change
  • It targets the unit level coding rather than what the code should actually do
  • Sometimes developer team find it waste of time if it is too poor.

Cucumber is a tool that can execute a plain text functional description as automation test.So cucumber is an acceptance testing tool but not an automation tool and Gherkin is an acceptance testing language.Cucumber acting as a bridge collaborates between stakeholders of the projects .Cucumber originally built in Ruby but currently supports java.

Setup :

Cucumber needs the following jars:

Open Eclipse,Create a java Project, right click on the project , go to build path then configure build path and click on library lab and click on Add External jar, select cucumber jars to add. Click on Open to add the them to the project.

Add all selenium related jars in the same way to the project.

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 29
  • 34
  • 28
  • 35
  • 12


  1. I reached out previously and hadn’t heard back from you yet. This tells me a few things:

    1) You’re being chased by a T-rex and haven’t had time to respond.
    2) You aren’t interested.
    3) You’re interested but haven’t had a time to respond.

    Whichever one it is, please let me know as I am getting worried! Please respond 1,2, or 3. I do not want to be a bother.

    ================================Original Message=============================

    Hi ,

    Sorry to intrude your mailbox.

    I saw you linked to https://mvnrepository.com/artifact/junit/junit/4.12 from https://www.techtravelhub.com/what-is-cucumber-how-to-work-with-cucumber/

    I would like to bring to your attention a resource I recently created – Guru99. https://www.guru99.com/download-installation-junit.html The content is up to date and very in-depth.

    I did be obliged if you link to it.

    As a thankyou, I would be glad to share your page with our 27k Facebook/Twitter/Linkedin Followers.


  2. I reached out previously and hadn’t heard back from you yet. This tells me a few things:

    1) You’re being chased by a T-rex and haven’t had time to respond.
    2) You aren’t interested.
    3) You’re interested but haven’t had a time to respond.

    Whichever one it is, please let me know as I am getting worried! Please respond 1,2, or 3. I do not want to be a bother.

    ================================Original Message=============================


    I stumbled upon your site today while searching for data on KEYWORD. You have awesome posts. Great Work!

    I couldn’t help notice that your linked to https://mvnrepository.com/artifact/junit/junit/4.12 at your page https://www.techtravelhub.com/what-is-cucumber-how-to-work-with-cucumber/.

    I wouLd like to suggest an article I recently created which is more in-depth and well researched article https://www.guru99.com/download-installation-junit.html .

    I would be honoured if you link to it.

    I did be happy to share your page with our 40k Facebook/Twitter/Linkedin Followers.



Please enter your comment!
Please enter your name here