Sunday, November 29, 2015

Details Of Feature File

On our previous post we learn how to setup eclipse and netbeans for Cucumber.

Now here we learn the heart of the cucumber that is known as feature file.

Feature file contains the all business logic or acceptance criteria. But we need to write this using specific language which is know as Gherkins.

Gherkins is basically english like language and it hold some keywords. We need to follow this keywords when we write down the feature file.

Keywords are mentioned below :

Feature : This tag contains the feature description.This tag basically required to describe the functionality of the application in brief. One feature file contains only one Feature tag.

Description : This tag contains the details of the Feature file.

Background : Backgrounds allows you to add some context to all scenarios in a single feature. A Background is like an untitled scenario, containing a number of steps. The difference is when it is run: the background is run before each of your scenarios,

Scenario : This tag specify the scenario name and details to check the feature of the application.

Given : The purpose of Given steps is to put the system in a known state before the user (or external system) starts interacting with the system

When : The purpose of When steps is to describe the key action the user performs.

Then : The purpose of Then steps is to observe outcomes. The observations should be related to the business value/benefit in your feature description. The observations should inspect the output of the system.

And : We can use And steps, allowing our Scenario to read more fluently:

But : We can use And steps, allowing our Scenario to read more fluently:

Scenario Outline : We use this when we need to run the same scenario with different data.

Examples : We supply the data to scenario outline using Example tag.

* : This is actually wild character, it can be used for the alternate of the above mentioned keyword.


We will know the details of each keywords on the later post with example.





Saturday, November 21, 2015

Cucumber SetUp in NetBeans

On our previous post we learn how to setup cucumber projects in Eclipse. Now we learn how to setup a NetBeans for cucumber.

Prerequisite:
Need to be installed Java SDK and NetBeans. We discussed here how to install Java SDK and Netbeans.

Step 1:

We need to download below jars :
a. cucumber-core-1.2.4.jar (This jar contains all the story terminology utilized from writing scenarios and implemented in the defining methods.)
b. cucumber-java-1.2.4.jar (This provides the Java runtime environment for all tests.)
c. cucumber-jvm-deps-1.0.5.jar (This module provides the Java parser for cucumber)
d. gherkin-2.12.2.jar   (gherkin is the language cucumber’s feature stories are written in, and this module contains parsing instructions for the features)
e. cucumber-junit-1.2.4.jar (This jar required for customized JUnit framework with cucumber.)
f. cucumber-html-0.2.3.jar (This provides a nice output in html format upon test completion.)

We can download this jars from  maven repository

and from sonatype repository.


now add all the jars in our projects.After adding all the jar project looks like below.

Step 2 :

Now we need to install cucumber plugin for Netbeans.

So open this url and click on download button. We found one .nbm file downloaded in our preferred download location.



Step 3:

Now we need to install this in Netbeans.
a. Click on Tools-> Plugins option.

b. Click on "Downloaded" tab from Plugins window and again click on "Add Plugins" button to select downloaded Netbeans Cucumber plugin file.

c. On next window shows  check box select this check box.

d. Accept term and condition.

e. Restart the Netbeans IDE.

After successful installation of Cucumber plugin .feature file in projects should be shown like below.




Cucumber file option should be available in NetBeans when we try to add any file in our project.



Saturday, November 14, 2015

Cucumber SetUp In Eclipse

On previous post we learn what is BDD and TDD and we also know the name of different type of BDD tools, Cucumber is one of those.

Here we learn how to configure cucumber in eclipse.

Prerequisite:
Need to be installed Java SDK and also downloaded the Eclipse. This configuration details describe here.

Now we download all the required jars for Cucumber setup.

Step 1: 

We need to download below jars :
a. cucumber-core-1.2.4.jar (This jar contains all the story terminology utilized from writing scenarios and implemented in the defining methods.)
b. cucumber-java-1.2.4.jar (This provides the Java runtime environment for all tests.)
c. cucumber-jvm-deps-1.0.5.jar (This module provides the Java parser for cucumber)
d. gherkin-2.12.2.jar   (gherkin is the language cucumber’s feature stories are written in, and this module contains parsing instructions for the features)
e. cucumber-junit-1.2.4.jar (This jar required for customized JUnit framework with cucumber.)
f. cucumber-html-0.2.3.jar (This provides a nice output in html format upon test completion.)

We can download this jar from  maven repository

and from sonatype repository.

now add all the jars in our projects.After adding all the jar project looks like below.


Step 2:
We need to add cucumber plugin in eclipse. There are so many plugin available for cucumber in eclipse.

We can add
a. Cucumber JVM Eclipse Plugin
                     OR
b. CucumberPeople

Lets starts with one by one we can install Cucumber JVM Eclipse Plugin in two different way

a. Cucumber JVM Eclipse Plugin Installation

i. Click on Help -> Install New Software

ii. Click on Add button and put name as Cucumber and location as  http://cucumber.github.com/cucumber-eclipse/update-siteClick ok button.

iii. Select all from List and click next button.

iv. Accept License and agreement.
v. Accept security  warning.
vi. Restart the eclipse.

Another way to install Cucumber JVM Eclipse Plugin is :

i. Open https://marketplace.eclipse.org/content/cucumber-jvm-eclipse-plugin


ii. Drag the Install button to Eclipse editor.

b. CucumberPeople Eclipse plugin installation


 Now we can install CucumberPeople if we are not interested to install the previous plugin.

We need to follow this steps to install this plugin.

i. From the Help menu, select Install New Software... to open an Install pop-up window.
ii. In the Name: field type Cucumber People and in  Location: text box type the URL https://alterhu.github.io/CucumberPeople/ then hit the Enter key.
iii. In the populated table below, check the box next to the name of the plug-in, and click the Next button.
iv. Click the Next button to go to the license page.
v. Choose the option to accept the terms of the license agreement, and click the Finish button.

After successful installation of Cucumber plugin .feature file in projects should be shown like below.
Intenseness should be available when writing feature file. 

Wednesday, November 11, 2015

Cucumber A Behavior Driven Development(BDD) Tool

Here we will learn about Cucumber a Behavior Driven Development(BDD) Tool.

What is BDD ?

Ans : Behavior Driven Development or BDD is a process where we will concentrate on the behavior of the application not on the implementation details. BDD use human understandable language where we try to focus the behavior of an application. So as it is a human readable language we can involve Business stakeholders, Business Analysts, QA Team and developers.

What is TDD ?
Ans : Test Driven Development or TDD is the approach where we write down all the expectation from the Application and can implement all the expectation gradually.

Explain the difference between TDD and BDD ?
Ans : Let's take an example of different type of sort like bubble,selection,merge, insertion sort. So if we go for the TDD, we need to write test cases for each and every sort because implementation of each sort are different but in BDD we need to write only one test case because every sort have the same expected outcomes and BDD focus on the expectation not on the implementation.

Can you mention some BDD tools name?
Ans : There are so many BDD tools available. Cucumber and Jbehave are some of those. This are open source tools.