My Blog List

Tuesday, April 19, 2016

Sample Cucumber with Java

Most of us should have heard about the term BDD - Behavious Driven Development. In this post, I would like to give some intro about familiar BDD framework called Cucumber and why we need BDD.

Why BDD?
Once people started moving to Test Driven Development (TDD), it helped a lot interms of reducing the bugs in development stage itself as every feature was developed by creating smaller unit tests, making it FAIL and coding the functionalities to make it PASS.

But eventually, the BAs and testers are not able to follow these testing practices and thus gap in communication which lead to lot of mis-understanding the features/requirements.

So, experts wanted a framework which should take inputs like normal people speaking English and should run the tests based on those requirement. Also this requirement will support as documentation of features to understand by testers/BAs/devs. Thus BDD was born.

BDD keywords:
Given, When, Then and And

Example:

Scenario: Login to Facebook
 Given Facebook login page
 When I enter valid username and passowrd
 Then I should see my home page
 And I should see my name

If you see above scenario, this will act as requirement as well as documentation. We are using this feature scenarios and connecting each steps to our own selenium steps written in java or any other language and running it.

To understand the .feature files and options that we can use for different way of execution, control, etc., read this documentation.
https://cucumber.io/docs/reference

You can find the sample project and start learning on your own.
https://github.com/SCSVEL/SampleCucumber-FB

6 comments:

  1. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium

    ReplyDelete
  2. This blog is really informative. I gained more knowledge by reading your post. Thanks for providing us the useful information with us. Your blog is really helpful for me in attaining my knowledge in a right way.

    Seo Training in Chennai

    ReplyDelete
  3. I have own car so now I am back out there trying to show him how to do car repairs. Your blog is an excellent source of info, thanks.

    bike spa services in mumbai
    house cleaning services in mumbai
    car wash services in mumbai

    ReplyDelete
  4. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care.As always, we appreciate you confidence and trust in us.
    Back to original

    ReplyDelete
  5. Truly a very good article on how to handle the future technology. After reading your post,thanks for taking the time to discuss this, I feel happy about and I love learning more about this topic
    Isoft Innovations Facebook
    Isoft Innovation Chennai

    ReplyDelete