Menu
Home Explore People Places Arts History Plants & Animals Science Life & Culture Technology
On this page
Cucumber (software)
Software tool for behavior-driven development

Cucumber is a software tool that supports behavior-driven development (BDD). Central to the Cucumber BDD approach is its ordinary language parser called Gherkin. It allows expected software behaviors to be specified in a logical language that customers can understand. As such, Cucumber allows the execution of feature documentation written in business-facing text. It is often used for testing other software. It runs automated acceptance tests written in a behavior-driven development (BDD) style.

Cucumber was originally written in the Ruby programming language and was originally used exclusively for Ruby testing as a complement to the RSpec BDD framework. Cucumber now supports a variety of different programming languages through various implementations, including Java and JavaScript. There is a port of Cucumber to .NET called SpecFlow, now superseded by Reqnroll.

We don't have any images related to Cucumber (software) yet.
We don't have any YouTube videos related to Cucumber (software) yet.
We don't have any PDF documents related to Cucumber (software) yet.
We don't have any Books related to Cucumber (software) yet.
We don't have any archived web articles related to Cucumber (software) yet.

Gherkin language

Gherkin is the language that Cucumber uses to define test cases. It is designed to be non-technical and human readable, and collectively describes use cases relating to a software system.23242526 The purpose behind Gherkin's syntax is to promote behavior-driven development practices across an entire development team, including business analysts and managers. It seeks to enforce firm, unambiguous requirements starting in the initial phases of requirements definition by business management and in other stages of the development lifecycle.

In addition to providing a script for automated testing, Gherkin's natural language syntax is designed to provide simple documentation of the code under test.27 Gherkin currently supports keywords in dozens of languages.28293031

Syntax

Syntax is centered around a line-oriented design, similar to that of Python. The structure of a file is defined using whitespace and other control characters.32 Lines starting with # are considered comments, and can be placed anywhere in a file.33 Instructions are any non-empty and non-comment line. They consist of a recognized Gherkin keyword followed by a string.34

All Gherkin files have the .feature file extension. They contain a single Feature definition for the system under test and are an executable test script.35

Here is an example of the syntax:36

Feature: Guess the word # The first example has two steps Scenario: Maker starts a game When the Maker starts a game Then the Maker waits for a Breaker to join # The second example has three steps Scenario: Breaker joins a game Given the Maker has started a game with the word "silky" When the Breaker joins the Maker's game Then the Breaker must guess a word with 5 characters

Command line

Cucumber comes with a built-in command line interface that covers a comprehensive list of instructions. Like most command line tools, cucumber provides the --help option that provides a summary of arguments the command accepts.37

$ cucumber --help -r, --require LIBRARY|DIR Require files before executing the features. --i18n LANG List keywords for in a particular language. Run with "--i18n help" to see all languages. -f, --format FORMAT How to format features (Default: pretty). -o, --out [FILE|DIR] Write output to a file/directory instead of ...

Cucumber command line can be used to quickly run defined tests. It also supports running a subset of scenarios by filtering tags.

$ cucumber --tags @tag-name

The above command helps in executing only those scenarios that have the specified @tag-name.38 Arguments can be provided as a logical OR or AND operation of tags. Apart from tags, scenarios can be filtered on scenario names.39

$ cucumber --name logout

The above command will run only those scenarios that contain the word 'logout'.

It is also useful to be able to know what went wrong when a test fails. Cucumber makes it easy to catch bugs in the code with the --backtrace option.40

  • Free and open-source software portal

References

  1. "The Pragmatic Bookshelf | The Cucumber Book". Pragprog.com. Archived from the original on 2012-01-21. Retrieved 2012-01-24. https://web.archive.org/web/20120121022646/http://pragprog.com/book/hwcuc/the-cucumber-book

  2. Rose, Seb; Wynne, Matt; Hellesøy, Aslak (15 February 2015). The Pragmatic Bookshelf | The Cucumber For Java Book. Pragprog.com. Retrieved 2019-04-28. https://pragprog.com/book/srjcuc/the-cucumber-for-java-book

  3. "What is Cucumber?". cucumber. Retrieved 2019-06-08. https://cucumber.io/docs/guides/overview/

  4. Aslak Hellesøy. "The world's most misunderstood collaboration tool". cucumber. https://cucumber.io/blog/the-worlds-most-misunderstood-collaboration-tool/

  5. Nagy, Gáspár; Rose, Seb (2017-03-07). The BDD Books - Discovery. Leanpub. ISBN 978-1983591259.{{cite book}}: CS1 maint: date and year (link) 978-1983591259

  6. Rose, Seb; Nagy, Gáspár (2021-04-27). The BDD Books – Formulation. Leanpub. ISBN 979-8723395015.{{cite book}}: CS1 maint: date and year (link) 979-8723395015

  7. Fox, Armando; Patterson, David (2016). Engineering Software as a Service. Strawberry Canyon. pp. 218–255. ISBN 978-0-9848812-4-6. 978-0-9848812-4-6

  8. "The Pragmatic Bookshelf | The Cucumber Book". Pragprog.com. Archived from the original on 2012-01-21. Retrieved 2012-01-24. https://web.archive.org/web/20120121022646/http://pragprog.com/book/hwcuc/the-cucumber-book

  9. Rose, Seb; Wynne, Matt; Hellesøy, Aslak (15 February 2015). The Pragmatic Bookshelf | The Cucumber For Java Book. Pragprog.com. Retrieved 2019-04-28. https://pragprog.com/book/srjcuc/the-cucumber-for-java-book

  10. "Automated testing with Selenium and Cucumber". www.ibm.com. 2013-08-06. Retrieved 2017-02-09. https://www.ibm.com/developerworks/library/a-automating-ria/

  11. Soeken, Mathias; Wille, Robert; Drechsler, Rolf (2012-05-29). Furia, Carlo A.; Nanz, Sebastian (eds.). Objects, Models, Components, Patterns. Lecture Notes in Computer Science. Springer Berlin Heidelberg. pp. 269–287. doi:10.1007/978-3-642-30561-0_19. ISBN 9783642305603. 9783642305603

  12. "The Pragmatic Bookshelf | The Cucumber Book". Pragprog.com. Archived from the original on 2012-01-21. Retrieved 2012-01-24. https://web.archive.org/web/20120121022646/http://pragprog.com/book/hwcuc/the-cucumber-book

  13. "The Pragmatic Bookshelf | The RSpec Book". Pragprog.com. 2010-12-02. Archived from the original on 2012-01-21. Retrieved 2012-01-24. https://web.archive.org/web/20120121003856/http://pragprog.com/book/achbd/the-rspec-book

  14. Rose, Seb; Wynne, Matt; Hellesøy, Aslak (15 February 2015). The Pragmatic Bookshelf | The Cucumber For Java Book. Pragprog.com. Retrieved 2019-04-28. https://pragprog.com/book/srjcuc/the-cucumber-for-java-book

  15. "Cucumber-jvm". cucumber. Retrieved 2018-03-08. https://github.com/cucumber/cucumber-jvm

  16. Rose, Seb; Wynne, Matt; Hellesøy, Aslak (15 February 2015). The Pragmatic Bookshelf | The Cucumber For Java Book. Pragprog.com. Retrieved 2019-04-28. https://pragprog.com/book/srjcuc/the-cucumber-for-java-book

  17. "Cucumber-js". cucumber. Retrieved 2018-03-08. https://github.com/cucumber/cucumber-js

  18. Naidele Manjunath; Olivier de Meulder (2019-02-01). "No Code? No Problem — Writing Tests in Plain English". Times Open. Retrieved 2019-04-29. https://open.nytimes.com/no-code-no-problem-writing-tests-in-plain-english-537827eaaa6e

  19. "Binding Business Requirements to .NET Code". SpecFlow. Retrieved 2019-04-29. https://specflow.org/

  20. "SpecFlow". GitHub. Retrieved 2019-04-29. https://github.com/techtalk/SpecFlow

  21. Richard Lawrence; Paul Rayner (2018). Behavior-Driven Development with Cucumber. Addison Wesley.

  22. Nagy, Gáspár (8 February 2024). "From SpecFlow to Reqnroll: Why and How". reqnroll.net. Reqnroll. Retrieved 18 April 2024. https://reqnroll.net/news/2024/02/from-specflow-to-reqnroll-why-and-how/

  23. "The Pragmatic Bookshelf | The Cucumber Book". Pragprog.com. Archived from the original on 2012-01-21. Retrieved 2012-01-24. https://web.archive.org/web/20120121022646/http://pragprog.com/book/hwcuc/the-cucumber-book

  24. Rose, Seb; Wynne, Matt; Hellesøy, Aslak (15 February 2015). The Pragmatic Bookshelf | The Cucumber For Java Book. Pragprog.com. Retrieved 2019-04-28. https://pragprog.com/book/srjcuc/the-cucumber-for-java-book

  25. "cucumber/gherkin". GitHub. Retrieved 2017-02-09. https://github.com/cucumber/cucumber/tree/master/gherkin

  26. "Gherkin Syntax". cucumber. Retrieved 2019-07-09. https://cucumber.io/docs/gherkin/

  27. "Gherkin Syntax". cucumber. Retrieved 2019-07-09. https://cucumber.io/docs/gherkin/

  28. "Gherkin Syntax". cucumber. Retrieved 2019-07-09. https://cucumber.io/docs/gherkin/

  29. "Gherkin Supported Languages". Gherkin. cucumber/cucumber: Cucumber monorepo - building blocks for Cucumber in various languages. Retrieved 2021-03-21 – via GitHub. https://github.com/cucumber/gherkin/blob/main/gherkin-languages.json

  30. "The Pragmatic Bookshelf | The Cucumber Book". Pragprog.com. Archived from the original on 2012-01-21. Retrieved 2012-01-24. https://web.archive.org/web/20120121022646/http://pragprog.com/book/hwcuc/the-cucumber-book

  31. Rose, Seb; Wynne, Matt; Hellesøy, Aslak (15 February 2015). The Pragmatic Bookshelf | The Cucumber For Java Book. Pragprog.com. Retrieved 2019-04-28. https://pragprog.com/book/srjcuc/the-cucumber-for-java-book

  32. "Gherkin Syntax". cucumber. Retrieved 2019-07-09. https://cucumber.io/docs/gherkin/

  33. "Gherkin Syntax". cucumber. Retrieved 2019-07-09. https://cucumber.io/docs/gherkin/

  34. "Reference". cucumber. Archived from the original on 2015-10-25. Retrieved 2016-01-17. https://web.archive.org/web/20151025214933/https://cucumber.io/docs/reference

  35. "Reference". cucumber. Archived from the original on 2015-10-25. Retrieved 2016-01-17. https://web.archive.org/web/20151025214933/https://cucumber.io/docs/reference

  36. "Gherkin Reference". cucumber. Archived from the original on 2024-01-13. Retrieved 2024-02-11. https://web.archive.org/web/20240113160832/https://cucumber.io/docs/gherkin/reference/

  37. Wynne, Matt; Hellesoy, Aslak. "The Cucumber Book". SafariBooksOnline. Retrieved 22 January 2016. https://www.safaribooksonline.com/library/view/the-cucumber-book/9781941222911/f_0090.html

  38. Wynne, Matt; Hellesoy, Aslak. "The Cucumber Book". SafariBooksOnline. Retrieved 22 January 2016. https://www.safaribooksonline.com/library/view/the-cucumber-book/9781941222911/f_0090.html

  39. Wynne, Matt; Hellesoy, Aslak. "The Cucumber Book". SafariBooksOnline. Retrieved 22 January 2016. https://www.safaribooksonline.com/library/view/the-cucumber-book/9781941222911/f_0090.html

  40. Wynne, Matt; Hellesoy, Aslak. "The Cucumber Book". SafariBooksOnline. Retrieved 22 January 2016. https://www.safaribooksonline.com/library/view/the-cucumber-book/9781941222911/f_0090.html