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
0
votes
1 answer

gherkin.parser.ParseError in a good-looking file

Gherkin fails with gherkin.parser.ParseError: Parse error at some.feature:5. Found comment when expecting one of: examples, feature, scenario, scenario_outline, tag. (Current getState: tag) with a some.feature that begins with # language:…
Andrey Regentov
  • 3,687
  • 4
  • 34
  • 40
0
votes
2 answers

Allure reports. Is there a way to write feature description?

I'm a newcomer in using Allure. Is there a way to write feature description in addition to the name? I mean, not only @Feature ("Editing user"), but something like "As admin I want to change a member info. So that I fill a new data on its card,…
Bohdan Nesteruk
  • 794
  • 17
  • 42
0
votes
1 answer

Robotframework Gherkin - How to log cookies to console?

Just started using the Robot Framework to test our application and I really like it so far. The option to combine it with Selenium, Appium and Locust.io in the end sounds appealing. Anyhow, I have a basic question: I'm trying to log the cookies from…
mathijsbrand
  • 413
  • 2
  • 16
0
votes
2 answers

How to verify if a key is into array in Behat

I have a problem with my test in behat. So I have the scenario : Scenario: Teste la route /settlement/rank/types Given I request "http:/localhost/admin" Then the response should be JSON And I should have code with value 200 And I should have…
Harea Costea
  • 275
  • 5
  • 19
0
votes
1 answer

Capturing an exit code for passing or failing Cucumber scenarios

I am writing Gherkin scenarios, I have an After hook I am currently working on. I want to be able to increment two variables (passing, failing) depending on the status of a scenario after it has been ran. Does Cucumber return an exit code, and if it…
0
votes
1 answer

Watir: selector for an a-href inside the first table cell

I have my css alias like: module MyPage def locator(key, *options) hash = { "FIRST_TABLE_CELL_HREF" => [ :css => '#my-table td:nth-child(1):first a'] } end I want to click on that…
VB_
  • 45,112
  • 42
  • 145
  • 293
0
votes
1 answer

Scenario to display multiple attributes on the page

Begging a pardon in advance for a newbie question. I'm writing a feature where visitor of the page should see several attributes of an item. The question is shall I add a separate feature for each attribute or separate scenarios of the same feature…
user487772
  • 8,800
  • 5
  • 47
  • 72
0
votes
1 answer

Jbehave - @BeforeScenario how to identify scenario

is it possible to execute something before a specific scenario runs? e.g in the example below i want to execute a piece of code before Scenario: 2 - Bar runs: Scenario: 1 - Foo Given a Foo When run Then success Scenario: 2 - Bar Given a Bar When…
bsferreira
  • 1,189
  • 5
  • 14
  • 27
0
votes
1 answer

Why the steps from the Background cannot be combined with Examples in Behat

Steps from the Background cannot be combined with Examples. Is it a limitation with Behat. I have the following feature file. Background: Given I have the login Page When I login to the application using "" Then the…
vijay pujar
  • 1,683
  • 4
  • 19
  • 32
0
votes
1 answer

cucumber feature: simulate multiple selection fields in a form

I have started writing the following feature within an app designed to manage a cleaning business: Feature: Creating a new cleaner In order to allow Franchisees to allocate cleaners to jobs they need to be uploaded to the system Background: …
user3735114
  • 41
  • 1
  • 6
0
votes
1 answer

How does cucumber When/Then arguments has the same object_id?

Just realized if I call twice #test.feature When test abc cba and test abc cba #test_steps.rb When(/^Test (.+)$/ do |arg| puts arg arg.remove! 'cba' end It will first return (puts) #=> abc cba and in the second call #=> abc ...interesting.…
Filip Bartuzi
  • 5,711
  • 7
  • 54
  • 102
0
votes
1 answer

Arguments syntax in Robot framework Gherkin style

How could I place arguments in the middle of the test step description? When I create a step like this everything goes OK (arguments are at the end of the step): *** Test Cases *** Scenario: Login as a valid user When user is logged in as: …
LeeWay
  • 793
  • 3
  • 16
  • 28
0
votes
2 answers

Is it possible for a .Net application to run Gherkin without SpecFlow

Part of our Team is migrating from a very bespoke in-house system to BDD-style test suites using cucumber As part of this migration I would like to create a .Net app that runs cucumber tests, but outputs the results of those tests in a format that…
underscorePez
  • 897
  • 9
  • 19
0
votes
1 answer

How to make ruby methods run before and after each [given, when, then] step?

I'm trying to get some easy-to-read time metrics for how long steps of each scenario take to run. I have methods that insert rows into a logging table like this: puts "#{Time.now} - Starting Given" puts "#{Time.now} - Ending Given" etc... And I…
user1029167
  • 349
  • 1
  • 4
  • 15
0
votes
1 answer

Spec flow scenario when button click Then the response text should contain .csv

I am new to specflow. Currently I am having a problem how to get a response text from browser button click. So below is my code Scenario Outline:Download Questions and it should contain csv file extension Given I am logged in as a user When I…
62071072SP
  • 1,963
  • 2
  • 19
  • 38