Questions tagged [gherkin]

Gherkin is the language used to write specifications for Cucumber, Specflow and similar BDD frameworks. It is a business-readable, domain-specific language that lets you describe your software’s behaviour without detailing how that behaviour is implemented.

Gherkin is the language used to write specifications for Cucumber, Specflow and similar BDD frameworks. It is a business-readable, domain-specific language that lets you describe your software’s behaviour without detailing how that behaviour is implemented.

Gherkin serves two purposes — documentation and automated tests. The third is a bonus feature — when it yells in red it’s talking to you, telling you what code you should write.

Gherkin’s grammar is defined in the Treetop grammar that is part of the Cucumber codebase. The grammar exists in different flavours for many spoken languages (37 at the time of writing), so that your team can use the keywords in your own language.

There are a few conventions:

  • A single Gherkin source file contains a description of a single feature.
  • Source files have the extension .feature.
  • There is a fundamental pattern to each Gherkin scenario, with a context: (Given), an event (When), and an outcome (Then).

Gherkin was invented by Alsak Hellesoy.

You can read more about Gherkin here: https://github.com/cucumber/gherkin/wiki

Documentation of Cucumber and Gherkin: https://www.cucumber.io/

.NET implementation: http://www.specflow.org/

Python implementation: https://behave.readthedocs.io/

1169 questions
19
votes
2 answers

Node.js BDD. Cucumber, gherkin, or cucumis?

I want to start using BDD for one of my Node.js projects. Looking at the Node.js wiki, I find at least 3 modules: Cucumber, gherkin, and cucumis that all support the gherkin language. Which ones do you recommend?
abendigo
  • 954
  • 1
  • 8
  • 31
19
votes
5 answers

How to input null-value into specflow step definition table

How can I input a null value in Specflow through a table? Let's look at an overly simplistic example: When a tire is attached to a car | CarId | TireModel | FabricationDate | Batch | | 1 | Nokian Hakka R | 2015-09-1 | | The…
Tuukka Haapaniemi
  • 1,156
  • 1
  • 11
  • 24
18
votes
2 answers

SpecFlow/Cucumber/Gherkin - Using tables in a scenario outline

Hopefully I can explain my issue clearly enough for others to understand, here we go, imagine I have the two following hypothetical scenarios: Scenario: Filter sweets by king size and nut content Given I am on the "Sweet/List" Page When I filter…
MattStacey
  • 875
  • 4
  • 12
  • 23
18
votes
3 answers

Is there a way to directly generate Step Definitions in Eclipse without Running Cucumber?

Im doing integration testing with cucumber and Gradle in Eclipse. For now my workflow is Write a feature file Run it to generate step skeletons Copy and implement them This works good for new features and so on, but becomes quite bothersome…
Dude
  • 692
  • 1
  • 4
  • 25
17
votes
1 answer

SpecFlow - How you properly use the "Background:" command in the feature file?

I've been reading articles, watching some screen-casts and playing around with a few sample/demo tutorials. I read an article where someone said "don't use too many backgrounds". I was curious so I tried it in SpecFlow's feature file and it…
Mastro
  • 1,477
  • 2
  • 22
  • 52
15
votes
2 answers

Sharing a common set of Examples across multiple Scenario Outlines in Specflow

Is is possible to share a common set of examples across multiple scenario outlines in Specflow without duplicating the set of examples for each outline? e.g. excuse the noddy example, but here the Examples are repeated for each Scenario Outline and…
AdaTheDev
  • 142,592
  • 28
  • 206
  • 200
15
votes
4 answers

Multiple feature inside single feature file

My current Cucumber file looks like this: Feature: Test Online application Page Scenario: Visit application home page and test links Scenario: Visit application Login and Validate login So now I would like to add few more scenarios may be for API…
Sunilkumar V
  • 912
  • 2
  • 8
  • 28
15
votes
2 answers

SpecFlow/Gherkin highlighting in Sublime Text 2

Does anyone know if there are any Sublime Text 2 packages available to enable syntax highlighting for SpecFlow / Gherkin specification files?
Stuart Hallows
  • 8,795
  • 5
  • 45
  • 57
14
votes
4 answers

Should Gherkin scenario always have When step?

When defining scenarios in Gherkin sometimes there is no clear distinction between Given and When steps, i.e. there is no active interaction with the system from the user and the purpose of the validation is to verify how the system should look…
Vagif Abilov
  • 9,835
  • 8
  • 55
  • 100
14
votes
2 answers

Can I change Gherkin formatting style in specflow?

Can I change Gherkin formatting style in specflow? How can I do this?
Roman Bats
  • 1,775
  • 3
  • 30
  • 40
13
votes
5 answers

Recommended reading to learn Gherkin

I wish to learn Gherkin so I can use it with specflow; I am looking for a document I can read on the train e.g. print out on paper. All I can find on the web is short disconnected descriptions that don’t tell a story and require lots of clicking…
Ian Ringrose
  • 51,220
  • 55
  • 213
  • 317
13
votes
3 answers

SpecFlow: Scenario Outline Examples

I just starting to work with SpecFlow and really like the tool. However I am running across some issues in relation to example data inputs into the Scenario Outlines. Just wondering if what I am facing is normal or whether there is a trick to it. I…
ccocker
  • 1,146
  • 5
  • 15
  • 39
13
votes
3 answers

Is it possible to reuse a feature as the "Given" for another feature?

Is it possible to reuse a feature as the "Given" for another feature? Or am I trying to do something I shouldn't be trying to do basically my features look like: Scenario: Creating a basic account with valid details (happy path) Given I am on the…
Michael Baldry
  • 1,990
  • 2
  • 14
  • 28
12
votes
3 answers

What's the best way to organize feature files?

One challenge I haven't solved yet is organizing my feature files and scenarios in a way, which makes it easy to navigate and explore in Specflow and BDD. Imagine one year later someone else wants to come along and learn about the system. Where to…
Pasho
  • 488
  • 3
  • 15
12
votes
12 answers

IntelliJ IDEA not recognizing .feature files

I have installed the cucumber-java and gherkin plugins in IntelliJ IDEA but when I create a .feature file it is not recognized as a feature file. I did restart IntelliJ and have checked to make sure the plugins are enabled in the plugins settings…
G-man
  • 133
  • 1
  • 1
  • 7
1
2
3
77 78