Cucumber (software)
Cucumber | |
---|---|
Basic data
|
|
Maintainer | Aslak Hellesøy, Joseph Wilk, Ben Mabey, Matt Wynne, Mike Sassak, Gregory Hnatiuk |
Publishing year | 2008 |
Current version |
6.0.5 ( November 13, 2019 ) |
operating system | Platform independent |
programming language | Ruby , Java , C ++ , JavaScript |
category | Behavior Driven Development Framework |
License | MIT license |
German speaking | Yes |
cucumber.io |
Cucumber is a behavior-driven development tool for the textual specification of requirements for software and for the automated checking of this description for its correct implementation.
Cucumber was originally written in the Ruby programming language for Ruby applications, but now it also supports other programming languages such as Java and all other programming languages running on the Java Virtual Machine as well as C ++ and JavaScript. In addition, there are projects that make Cucumber available for other programming languages and see themselves as part of the Cucumber family, including SpecFlow, an implementation for C #.
example
As with most other behavior-driven development tools, functionalities in Cucumber are described using the description language "Gherkin". Gherkin uses natural written language as a basis, only certain key words are given special treatment. In order for a functionality to be written in German, it must be # language: de
specified at the beginning of the feature . So are u. a. the key words "functionality", "basis", "scenario", "scenario floor plan", "examples", "assumed", "given", "if", "then", "and" and "but", as well as "* "pre-assigned.
A functionality described in this way could, for example, consist of a single scenario and look like this:
# language: de Funktionalität: Division Um Fehler zu vermeiden, müssen die Kassierer in der Lage sein, Divisionen auszurechnen Szenario: Regular numbers Angenommen ich habe die Zahl 3 im Taschenrechner eingegeben Und ich habe die Taste "Division" gedrückt Und ich habe die Zahl 2 im Taschenrechner eingegeben Wenn ich auf die Taste "Gleich" drücke Dann sollte als Resultat 1,5 am Bildschirm ausgegeben werden
This functionality, described in German in Gherkin, can now be processed in Ruby, for example. For this purpose, the lines marked by means of the key words are processed in individual steps. When defining the steps (“step definitions”), Cucumber uses regular expressions in order to be able to process similarly formulated steps or to react to variable definitions such as the numbers 2, 3, and 1.5 in this example to be able to:
# encoding: utf-8
begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end
require 'cucumber/formatter/unicode'
$:.unshift(File.dirname(__FILE__) + '/../../lib')
require 'taschenrechner'
Before do
@calc = Taschenrechner.new
end
After do
end
Given /ich habe die Zahl (\d+) im Taschenrechner eingegeben/ do |n|
@calc.push n.to_i
end
When /ich auf (\w+) drücke/ do |op|
@result = @calc.send op
end
Then /sollte als Resultat (.*) am Bildschirm ausgegeben werden/ do |result|
@result.should == result.to_f
end
literature
- Matt Wynne, Aslak Hellesøy: The Cucumber Book. Behavior-Driven Development for Testers and Developers (= The Pragmatic Programmers ). The Pragmatic Bookshelf, Dallas TX u. a. 2012, ISBN 978-1-934356-80-7 .
- Ian Dees, Matt Wynne, Aslak Hellesøy: Cucumber Recipes . Automate Anything with BDD Tools and Techniques (= The Pragmatic Programmers ). The Pragmatic Bookshelf, Dallas TX u. a. 2013, ISBN 978-1-937785-01-7 .
- Reuven M. Lerner: At the Forge - Cucumber . In: Linux Journal . No. 189 , January 1, 2010 ( linuxjournal.com [accessed May 26, 2016]).
- David de Florinier, Gojko Adzic: The Secret Ninja Cucumber Scrolls . Strictly Confidential. March 16, 2011 ( cuke4ninja.com [accessed May 2, 2013]).
Web links
Individual evidence
- ^ Cucumber home page
- ↑ Release 6.0.5 . November 13, 2019 (accessed November 14, 2019).
- ^ The Pragmatic Bookshelf | The Cucumber Book . Pragprog.com. Retrieved January 24, 2012.
- ^ The Pragmatic Bookshelf | The RSpec Book . Pragprog.com. December 2, 2010. Retrieved January 24, 2012.
- ^ Cucumber Repository
- ↑ SpecFlow, pragmatic BDD for .Net ( Memento from September 11, 2013 in the Internet Archive )
- ↑ Cucumber - Gherkin. Cucumber, accessed November 9, 2011 .
- ^ Gherkin languages ( Memento from September 7, 2015 in the Internet Archive )
- ↑ aslakhellesoy: examples / i18n / en / features / division.feature at master from cucumber / cucumber . GitHub. January 15, 2012. Retrieved on January 24, 2012. ( Page no longer available , search in web archives ) Info: The link was automatically marked as defective. Please check the link according to the instructions and then remove this notice.
- ↑ aslakhellesoy: examples / i18n / en / features / step_definitions / calculator_steps.rb at master from cucumber / cucumber . GitHub. January 15, 2012. Retrieved on January 24, 2012. ( Page no longer available , search in web archives ) Info: The link was automatically marked as defective. Please check the link according to the instructions and then remove this notice.