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

How Can I write Gherkin script writing as I am a beginner and I dont know where to start

Can someone save my life? How can I create two simple test cases written in the descriptive language Gherkin (maximum 10 lines)? Based on the popular messenger app WhatsApp (example: “send message button” functionality) or the www.google.com…
Mouse
  • 1
-1
votes
1 answer

How to use dynamic parameter name in java method?

first of all i have method like this ; @When("^I send google-login-api with \"([^\"]*)\" token$") public void googleLoginApi(String googleTokenSuccess) throws IOException { String body = new…
-1
votes
1 answer

Regex to capture patterns using JavaScript

I am new to automation ! I use wdio5 , cucumber and selenium framework with gherkin language . I need to write a step file using JavaScript for the gherkin feature that needs to add these patterns Examples 52.27 .27 2.27 I hope I asked the question…
-1
votes
1 answer

hyphen is not accepting in karate UI automation

I am trying to enter some value in text box using Karate UI automation using the below command And input("textarea[class=ace_text-input]", 'index = "int_rtrapp-dev_k8s" container_name="rr-hebeat-inbound" "' + tracID + '"') In the above command…
sarath
  • 455
  • 1
  • 11
  • 26
-1
votes
1 answer

Written test does not work the same every time using Selenium and Python

I have link on web page and after click it system dialog window is open. Everything work fine when code is in one file (simple script). When I use Page Object Model and run test it is works strange. I mean sometimes element is clickable and system…
Michał_M
  • 11
  • 4
-1
votes
1 answer

Cucumber: loop over only part of the Scenario

is there any possibility to loop part of the scenario instead of all steps. Below I have prepared an example, I want to login and click a list of links, but I want to execute the login-part only once. After logging the clicking part should be…
Tester
  • 1
  • 1
-1
votes
1 answer

How to scroll page?

I am trying to write a function that will scroll the page down to a specific element on the page. But it is not working. I am using Python + Selenium + Gherkin My BasePage.py file def scroll_page(self, by_locator): element =…
Michał_M
  • 11
  • 4
-1
votes
1 answer

Specflow cannot process special characters

I'm trying to check DB entries using feature files in specflow an it doesn't seem to work. Instead of reading the DB entry (that contains special characters (µ,ß,ä...), Specflow recognises characters such as µ,ß,ä as little '?'. Is there any kind of…
MehPanzer
  • 19
  • 1
  • 7
-1
votes
2 answers

Unable to locate element -- OpenQA.Selenium.NoSuchElementException

I am trying to automate a test case through Specflow, by using the Gherkin format, but I keep getting the error: OpenQA.Selenium.NoSuchElementException : no such element: Unable to locate element:…
GerRax
  • 59
  • 1
  • 8
-1
votes
1 answer

Cannot convert type 'int' to 'string' in a Specflow file

I am trying to run test cases created through Specflow, but I am having an error. The idea behind the code is that I have a Feature file, a Step Definition file and a Page file. I am able to open the browser, but when it is supposed to enter the…
GerRax
  • 59
  • 1
  • 8
-1
votes
1 answer

Log in console Gherkin steps with Robot Framework

I want to use Robot Framework to write and execute Test Cases in Gherkin format. What I want is when I execute a Test Case, output in the console besides the name of the Scenario, each step (When, Then...) and log as well if the step passes or not.
-1
votes
1 answer

Use a variable to fill a field with Cucumber

It is possible to use a variable to set a value using Selenium - Cucumber? In my Class.Java : I tried to create a private variable ( private String username = "x"; ) with Setter ( public void setUsername(String username).. ) But the value doesn't…
Yann
  • 1
-1
votes
1 answer

BDD iteration using gherkin and specflow

We are starting to implement BDD and we have a scenario that I don't know how to implement. We implemented BDD using Specflow with selenium. In the web page there's a Dropdown that when you switch the content, the web page also changes. I would like…
-1
votes
1 answer

BDD-JAVA- Is it possible to generate cucumber html reports with only scenario titles with out steps

I am currently using an HTML formatter to generate the Cucumber HTML report. The report is pretty, but I want the reports to be generated with all scenarios only with the title so that my report is not huge and easy to know which scenarios…
-1
votes
2 answers

How to give multiple parameters in the cucumber feature file

Can i know how to pass multiple parameters in the feature file(cucumber)..? eg: i need to automate the links in the footer section of a website like there are more than 14 links in the section. Which way is good to pass those multiple…
1 2 3
77
78