Introduction of Using Selenium With Cucumber-JVM


What is BDD:
Every software/Application/system have its own behavior or requirement as per the domain (e-Commerce, Banking, Finance etc.). The behavior of software is documented and software team (Dev, QA and BA) will use this document to develop the software and follow a process that involves several roles in the team. This process is called BDD.


What is Cucumber ?

Cucumber is a testing framework that helps to bridge the gap between software developers and business managers. Tests are written in plain language based on the behavior-driven development (BDD) style of Given, When, Then which any layperson can understand. Cucumber allows software development teams describe how software should behave in plain text. The text is written in a business-readable domain-specific language and serves
as documentation, automated tests and development-aid – all rolled into one format.

Why Cucumber ?

Cucumber allows you to write feature documentation in Plain Text. It means you could sit with your Client or Business Analyst to write down the features to be built on your application. Hence proper use of this framework has a great potential to bridge the gap between business people and development people.

Let see what are these & how it could help us.

Feature File: 

Feature:  A feature would describe the current testscript which has to be executed.

 Scenario: Scenario would describe the steps and expected outcome for a particular test case.

 Background: Background describes the steps that would be executed before each scenario

Scenario Outline: Using Scenario Outline, we can execute the same scenarios for multiple sets of data. The data is provided in a tabular structure(separated by | |) under Examples.The step definitions can be parameterized by providing the column header in angular brackets(< >). Double quotes for each parameter needs to be put in the table and not in the step definition.

 Given: ‘Given’ specifies the context of the text to be executed. Given step can also be parameterized using datatables. 

When: ‘When’ specifies the test action to be performed. 

Then: ‘Then’ specifies the expected outcome of the test.

 Parameters can be passed in each stepdefinition within double quotes(“”).It will read as Regex format.

Tags can be provided for different scenarios, features or backgrounds. The tags would help in determining the specific scripts that would be executed.

Example :

The main feature of the Cucumber is that it focuses on Acceptance testing.This made easy for anyone in the team to read and write a test and with this feature it brings business users in to the test process, helping teams to explore and understand requirements.

Feature: Signup Action To Be Done

@Sanity

Scenario: New users should get a confirmation email and be greeted
personally by the site once signed in.

Given I have chosen to sign up
When I sign up with valid details
Then I should receive a confirmation email
And I should see a personalized greeting message

Scenario: Duplicate email

Given I have chosen to sign up
When I enter an email address that has already registered
Then I should be told that the email is already registered
Now just by seeing at the above example anybody can understand the working of the test and what it is intend to do. Any  business user would read and understand the test and able to give you the feedback that whether it reflects their understanding of what the system should do, and it can even leads to thinking of other
scenarios that needs to be consider too.

Advertisements

3 thoughts on “Introduction of Using Selenium With Cucumber-JVM

  1. K Govindraj August 29, 2015 / 10:01 am

    I am testing trainer. I would like to learn Cucumber

    Like

    • charan163 August 30, 2015 / 5:05 pm

      I’d love to help.You could check the articles too.

      Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s