- Cucumber (software)
-
Cucumber Developer(s) Aslak Hellesøy[2], Joseph Wilk[3], Matt Wynne[4], Gregory Hnatiuk[5], Mike Sassak[6] Stable release 1.0.2 Operating system Cross-platform Type Behavior driven development framework / Test tool License MIT License Website cukes.info Cucumber is a tool for running automated acceptance tests written in a behavior driven development (BDD) style. Cucumber is written in Ruby programming language.[7][8] Cucumber allows the execution of feature documentation written in business-facing text.
Contents
Example
A feature definition, with a single scenario[9]:
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"[10]:
# 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[11]. According to a Mashable survey[12], it is the 5th most popular testing framework in use by startup companies.
References
- ^ https://rubygems.org/gems/cucumber/versions/1.0.2
- ^ http://aslakhellesoy.com/
- ^ http://blog.josephwilk.net/
- ^ http://blog.mattwynne.net/
- ^ https://github.com/ghnatiuk
- ^ https://github.com/msassak
- ^ http://pragprog.com/book/hwcuc/the-cucumber-book
- ^ http://pragprog.com/book/achbd/the-rspec-book
- ^ https://github.com/cucumber/cucumber/blob/master/examples/i18n/en/features/division.feature
- ^ https://github.com/cucumber/cucumber/blob/master/examples/i18n/en/features/step_definitons/calculator_steps.rb
- ^ http://rubygems.org/gems/cucumber/stats
- ^ http://mashable.com/2011/07/26/startup-tools/
External links
- Cucumber project
- Cucumber (GitHub profile)
- Cucumber (Ruby Gem)
- Cucumber generators and runtime for Rails (Ruby Gem)
- At the Forge - Cucumber, by Reuven M. Lerner in the Linux Journal
- Agile 2009 - Aslak Hellesoy - Cucumber test framework, podcast by Bob Payne with Aslak Hellesøy
- Cucumber: The Latest in Ruby Testing, by Mike Gunderloy
- The Secret Ninja Cucumber Scrolls, by Gojko Adzic and David de Florinier
Categories:- Software testing tools
- Software using the MIT license
- Computer programming tool stubs
Wikimedia Foundation. 2010.