Cucumber (software)
Encyclopedia
Cucumber is a tool for running automated acceptance tests written in a behavior driven development
Behavior driven development
Behavior-driven development is an agile software development technique that encourages collaboration between developers, QA and non-technical or business participants in a software project...

 (BDD) style. Cucumber is written in Ruby programming language
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...

. Cucumber allows the execution of feature documentation written in business-facing text.

Example

A feature definition, with a single scenario:

Feature: Division
In order to avoid silly mistakes
Cashiers must be able to calculate a fraction

Scenario: Regular numbers
* I have entered 3 into the calculator
* I press divide
* I have entered 2 into the calculator

Result: Should be 1.5 on the screen


The execution of the test implicit in the feature definition above requires the definition, using the Ruby language, of a few "steps":
  1. encoding: utf-8

begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end
require 'cucumber/formatter/unicode'
$:.unshift(File.dirname(__FILE__) + '/../../lib')
require 'calculator'

Before do
@calc = Calculator.new
end

After do
end

Given /I have entered (\d+) into the calculator/ do |n|
@calc.push n.to_i
end

When /I press (\w+)/ do |op|
@result = @calc.send op
end

Then /the result should be (.*) on the screen/ do |result|
@result.should

result.to_f
end

Popularity


Cucumber has been downloaded over 829,873 times. According to a Mashable
Mashable
Mashable is an American news website and Internet news blog founded by Pete Cashmore. The website's primary focus is social media news, but also covers news and developments in mobile, entertainment, online video, business, web development, technology, memes and gadgets...

 survey, it is the 5th most popular testing framework in use by startup
Startup company
A startup company or startup is a company with a limited operating history. These companies, generally newly created, are in a phase of development and research for markets...

 companies.

External links
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK