PROGRAM CUCUMBER

Introduction

Cucumber is an analysis tool that ropes Behavior Driven Development framework. It describes application behavior using guileless English text, defined by a language known as Gherkin. Cucumber lets automation functional authentication that is easily read and unspoken. Cucumber was originally implemented in Ruby and formerly extended to Java. Both the gears support innate JUnit.

Cucumber feature files container serve as a good text for all. There are numerous other tools like JBehave which too support BDD tool. Behavior Driven Development is Test Driven Development then it is used to test the system somewhat than testing the specific piece of code. We will deliberate more about the BDD and style of script BDD tests.

Cucumber can be rummage-sale along by Selenium, Watir, and Capybara etc. Cucumber ropes many other languages similar Perl, PHP, Python, .Net etc. we will distillate on Cucumber through Java as a language. There are following steps.

Feature Files:

Feature files are vital part of cucumber which is used to write test mechanization steps or receipt tests. This can be used as living document. The steps are the application requirement. Altogether the feature files ends by .feature extension.

Example:

Feature: Login Functionality Feature

In order to guarantee Login Functionality everything, I want to execute the cucumber test to confirm it is working.

 

Feature:

This gives info about the high equal business functionality and the drive of Application under test. Everybody must be able to understand the determined of feature file by interpretation the first Feature step. This part is essentially kept brief.

Scenario:

Basically a scenario signifies a particular functionality which is below test. By sighted the scenario user should be able to comprehend the intent behindhand the scenario and what the examination is all about. Each scenario must follow given, when and formerly format. This language is known as as “gherkin”.

  1. Given: As mentioned overhead, given specifies the pre-conditions. It is essentially a known state.
  2. When: This is used once some action is to be did. As in above example we consume seen when the user tries to log in by username and PIN, it develops an action.
  3. Then: The predictable outcome or result should be located here. For Instance: confirm the login is successful, fruitful page navigation.
  4. Background: Whenever any stage is required to perform in separately scenario then those steps needs to be located in Background. For Instance: If operator needs to clear database beforehand each scenario then persons steps can be put in background.
  5. And: And is used to syndicate two or more same type of act.

Example:

Background:

Given customer logged in as databases manager
and all the junk standards are cleared

Scenario Outline:

Scenario outlines remain used when same test has to be did with different data set. Let’s take the similar example. We consume to test login functionality with multiple dissimilar set of username and PIN.

Feature: Login Functionality Feature

In order to confirm Login Functionality works, I poverty to run the cucumber test to confirm it is working

Note:

  1. As shown in above instance column names are passed as limit to When statement.
  2. In home of Scenario, you have to use Scenario Plan.
  3. Examples are used to pass dissimilar arguments in tabular arrangement. Perpendicular pipes are used to separate two dissimilar columns. Example can cover many different columns.

#5) Tags:

Cucumber by evasion runs all scenarios in all the feature archives. In real while projects there could be hundreds of feature file which are not obligatory to run at all times. Cucumber determination run only those feature files exact to given tags. Please follow the below instance. You can specify manifold tags in one feature file.

Example:

Feature: Login Functionality Feature

In order to safeguard Login Functionality works, I want to execute the cucumber test to confirm it is working

 

Junit Runner:

To run the exact feature file cucumber uses normal Junit Runner and specify labels in @Cucumber. Options. Multiple tags can be assumed by using comma distinct. Here you can specify the trail of the report and type of account you want to generate.

 

Cucumber Report:

Cucumber makes its own html format. However healthier reporting can be complete using Jenkins or bamboo tool. Particulars of reporting are covered in following topic of cucumber.

 

Conclusion:

We have enclosed features of cucumber tool and its use in real period scenario.
Cucumber is a most preferred tool for many projects as it is informal to understand, clear and covers business functionality.

Reference:

  1.  “Aslak Hellesøy”. Aslakhellesoy.com.
  2. “Joseph Wilk | on AI, The Web, Usability, Testing & Software process”. Blog.josephwilk.net.
  3. “Tea-Driven Development”. Blog.mattwynne.net.
  4. “ghnatiuk’s Profile”. GitHub.
  5.  “msassak’s Profile”. GitHub.
  6.  “cucumber | RubyGems.org | your community gem host”. RubyGems.org.
  7. “Automated testing with Selenium and Cucumber”. www.ibm.com.

Leave a Reply

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