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...
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":
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...
Linux Journal is a monthly technology magazine published by Belltown Media, Inc. of Houston, Texas. The magazine focuses specifically on Linux, allowing the content to be a highly specialized source of information for open source enthusiasts.-History:...
Gojko Adzic is an agile testing and development proponent, author of several books, coach and mentor.His book, "Specification by Example", presented the idea of moving to 'living documentation' and 'active specification'...
and David de Florinier
The source of this article is wikipedia, the free encyclopedia. The text of this article is licensed under the GFDL.