<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tomasz Jakobiec</title>
    <description>The latest articles on DEV Community by Tomasz Jakobiec (@tomeczkie94).</description>
    <link>https://dev.to/tomeczkie94</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F625833%2F84749a0a-7cd1-47a1-a5a7-07a7b7aa501a.png</url>
      <title>DEV Community: Tomasz Jakobiec</title>
      <link>https://dev.to/tomeczkie94</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tomeczkie94"/>
    <language>en</language>
    <item>
      <title>How To Start Writing Gherkin Test Scenarios?</title>
      <dc:creator>Tomasz Jakobiec</dc:creator>
      <pubDate>Tue, 13 Jul 2021 11:00:42 +0000</pubDate>
      <link>https://dev.to/selleo/how-to-start-writing-gherkin-test-scenarios-ikf</link>
      <guid>https://dev.to/selleo/how-to-start-writing-gherkin-test-scenarios-ikf</guid>
      <description>&lt;p&gt;Gherkin Syntax is a buzzing word nowadays in the software development world. But many developers and businesses are yet unfamiliar with Gherkin technology.&lt;/p&gt;

&lt;p&gt;Some time ago, I published a &lt;a href="https://selleo.com/blog/beginners-guide-to-gherkin"&gt;Beginner’s Guide to Gherkin&lt;/a&gt;. Now it is time to tackle the topic in more detail. In this post, we will finally learn how to write Gherkin test scenarios successfully. Are you ready? Let’s begin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Get Familiar with the Basics of Gherkin Syntax
&lt;/h2&gt;

&lt;p&gt;Gherkin is a machine-readable business language that allows you to define business activity without getting entangled in technical specifics. It's a domain-specific language for defining requirements tests in Cucumber format. It describes use cases in simple Terms and helps users to eliminate logic elements from behavior testing.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Gherkin Syntax?
&lt;/h3&gt;

&lt;p&gt;Gherkin, like YAML and Python, is a line-oriented programming language. Each line in the terminals is referred to as a step, and it begins with keywords and ends with a stop. Indentation is done with a tab or space.&lt;/p&gt;

&lt;p&gt;A comment can be placed anywhere in this script, but it must begin with the # symbol. After deleting Ghrekin's keywords like given, when, and so on, it reads each sentence.&lt;/p&gt;

&lt;p&gt;The following are examples of typical Gherkin steps:&lt;/p&gt;

&lt;p&gt;Gherkin Scripts: bridges the gap between the human idea of cause and effect and the software model of input/process/output.&lt;/p&gt;

&lt;p&gt;
Gherkin Syntax:&lt;br&gt;&lt;br&gt;
Feature: Title of the Scenario&lt;br&gt;
Given [Preconditions or Initial Context]&lt;br&gt;
When [Event or Trigger]&lt;br&gt;
Then [Expected output]
&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Know the Gherkin keywords
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X141AIWE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/720x246/eb3308d72a/step-2.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X141AIWE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/720x246/eb3308d72a/step-2.jpeg" alt="Img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each line that isn't blank must begin with a Gherkin keyword and then be continued by any content you choose. The functionality and scenario explanations are the only exceptions. I described those keywords in more detail in the post &lt;a href="https://selleo.com/blog/beginners-guide-to-gherkin"&gt;Beginner’s Guide To Gherkin&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Primary Keywords
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://cucumber.io/docs/gherkin/reference/#feature"&gt;Feature&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cucumber.io/docs/gherkin/reference/#rule"&gt;Rule&lt;/a&gt; (as of Gherkin 6)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cucumber.io/docs/gherkin/reference/#example"&gt;Example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cucumber.io/docs/gherkin/reference/#given"&gt;Given&lt;/a&gt;, &lt;a href="https://cucumber.io/docs/gherkin/reference/#when"&gt;When&lt;/a&gt;, &lt;a href="https://cucumber.io/docs/gherkin/reference/#then"&gt;Then&lt;/a&gt;, &lt;a href="https://cucumber.io/docs/gherkin/reference/#and-but"&gt;And&lt;/a&gt;, &lt;a href="https://cucumber.io/docs/gherkin/reference/#and-but"&gt;But&lt;/a&gt; for steps (or &lt;a href="https://cucumber.io/docs/gherkin/reference/#Asterisk"&gt;*&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cucumber.io/docs/gherkin/reference/#background"&gt;Background&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cucumber.io/docs/gherkin/reference/#scenario-outline"&gt;Scenario Outline&lt;/a&gt; (or &lt;a href="https://cucumber.io/docs/gherkin/reference/#scenario-outline"&gt;Scenario Template&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cucumber.io/docs/gherkin/reference/#examples"&gt;Examples&lt;/a&gt; (or &lt;a href="https://cucumber.io/docs/gherkin/reference/#examples"&gt;Scenarios&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Secondary Keywords
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;" (Doc Strings)&lt;/li&gt;
&lt;li&gt;| (Data Tables)&lt;/li&gt;
&lt;li&gt;@ (Tags)&lt;/li&gt;
&lt;li&gt;# (Comments)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 3: The Simple Rules for Gherkin Developers
&lt;/h2&gt;

&lt;p&gt;There are some golden rules to always keep in mind for Gherkin and these are as follow:&lt;/p&gt;

&lt;h3&gt;
  
  
  The Golden Rule of Gherkin
&lt;/h3&gt;

&lt;p&gt;The Golden Rule of Gherkin is straightforward: treat other readers the way you want to be treated. Create functionality files in a way everybody can comprehend them easily. By defining the behaviors you wish to cultivate, a successful Gherkin should increase team cooperation. If Gherkin scenarios are tough to read, teams can’t develop good behaviors&lt;/p&gt;

&lt;p&gt;Write scenarios in an intuitive manner and test scenarios shouldn’t be ultra-declarative or ultra-imperative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ultra-Declarative Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8f5nJjjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/204x88/909e32d5e9/image6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8f5nJjjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/204x88/909e32d5e9/image6.png" alt="Img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What seems to go wrong here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is too vague&lt;/li&gt;
&lt;li&gt;Steps are not procedural - not automatable&lt;/li&gt;
&lt;li&gt;Lacks accountability - it omits conditions for success&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s check Ultra-Imperative example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y8dwJnkF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/445x331/8500fb1c1b/image4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y8dwJnkF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/445x331/8500fb1c1b/image4.png" alt="Img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is too much in detail&lt;/li&gt;
&lt;li&gt;Steps name manual, low-level interactions&lt;/li&gt;
&lt;li&gt;Wall of text worsens the understandability and collaboration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Here’s the correct Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JFFCsJjE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/387x105/e5bc9cf4fb/image10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JFFCsJjE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/387x105/e5bc9cf4fb/image10.png" alt="Img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The scenario has declarative, descriptive steps&lt;/li&gt;
&lt;li&gt;Given-When-Then order is followed&lt;/li&gt;
&lt;li&gt;Interaction and desired behavior are clearly shown&lt;/li&gt;
&lt;li&gt;Concrete example helps the reader to understand the scenario&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Cardinal Rule of BDD
&lt;/h3&gt;

&lt;p&gt;The cardinal rule of BDD is a one-to-one rule: each scenario should cover precisely one single, independent behavior. Concentrating on one behavior at a time provides several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Collaboration: More clarity and less ambiguity&lt;/li&gt;
&lt;li&gt;Automation: Each test failure identifies a separate issue.&lt;/li&gt;
&lt;li&gt;Efficiency: Less complicated Work has a shorter cycle time.&lt;/li&gt;
&lt;li&gt;Traceability: consists of one behavior, one example, one situation, one test, and one outcome.&lt;/li&gt;
&lt;li&gt;Accountability: Teams are not allowed to hide or avoid behaviors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example of an Incorrect Scenario:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f1H6Xe1H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/429x115/457712a3e2/image13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f1H6Xe1H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/429x115/457712a3e2/image13.png" alt="Img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;What’s wrong here?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Covers two separate behaviors (two When-Then pairs)&lt;/li&gt;
&lt;li&gt;If you included two or more Given-When pairs in your test, it’s better to split them to a different Gherkin scenario (below)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BcOMTLKb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lh4.googleusercontent.com/FCAjPTUxm4qUEZB6Di59IB6ZAQcFgnBOqQiZLn9y_FmecdGYYm0xAyxvwUZP7ZIuLziVmgIx19Y_J6pGVsmfAirvBchR64jbiNTxIPy-nclBELiPRE-mDMHUuV5WRy9wn_Y8WFfn" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BcOMTLKb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lh4.googleusercontent.com/FCAjPTUxm4qUEZB6Di59IB6ZAQcFgnBOqQiZLn9y_FmecdGYYm0xAyxvwUZP7ZIuLziVmgIx19Y_J6pGVsmfAirvBchR64jbiNTxIPy-nclBELiPRE-mDMHUuV5WRy9wn_Y8WFfn" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are times when it is more convenient and acceptable to write multiple ‘When-Then’ pairs but it should be avoided in general.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Unique Example Rule
&lt;/h3&gt;

&lt;p&gt;When it comes to instances, sometimes less is more, therefore leave out the ones that aren't required. Instead, concentrate on unique equivalence classes. While testing "everything" may seem appealing, it is a waste of time. Instead, focus on the most critical aspects of your project and minimize testing duplicates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LhyJbjLM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/368x229/528c0c91d7/image.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LhyJbjLM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/368x229/528c0c91d7/image.png" alt="Img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;What’s Wrong Here!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the example above, the scenario would run 6 times - 1 for each row in the examples table&lt;/li&gt;
&lt;li&gt;Though testing “all the things” may be tempting, it’s better to test the most important things, and avoid testing duplicates&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Golden Rule of Grammar
&lt;/h3&gt;

&lt;p&gt;Because language is important, write as though your high school English instructor is grading your Gherkin. The goal of behavior scenarios is for them to be legible and expressive. Steps are designed to be reused. The benefits of behavior specification can be ruined by poor syntax, misspellings, and contradictory phrasing. Scenarios might get perplexing, and team members may employ actions that aren't relevant to the situation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example # 1:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X_rMqbbQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/301x77/69f26cb040/image11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X_rMqbbQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/301x77/69f26cb040/image11.png" alt="Img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;What’s Wrong Here!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The above scenario is inconsistent and ambiguous - it’s not clear whether “I” am “the user” or if there is a third party involved. Moreover, using the third-person perspective exclusively is more elegant.&lt;/li&gt;
&lt;li&gt;Phrase steps as you would write regular sentences&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example # 2:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Nwys1TSb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/250x61/489db77b18/image3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nwys1TSb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/250x61/489db77b18/image3.png" alt="Img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;What’s Wrong Here!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Phrase steps as you would write regular sentences&lt;/li&gt;
&lt;li&gt;We don’t know if the above steps verify the existence of the links or click them - we need to clarify them:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Correct Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vN0liLnC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/396x48/8f5fd6a9c3/image1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vN0liLnC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/396x48/8f5fd6a9c3/image1.png" alt="Img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 4: Write Good Titles&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;For well-written scenarios, creating strong titles is simple. An excellent Gherkin scenario concentrates on a single specific action. Take a pause and ask yourself, "Is this scenario a good scenario?" To help you build amazing scenarios, see the post &lt;a href="https://automationpanda.com/2020/02/21/4-rules-for-writing-good-gherkin/"&gt;4 Rules for Writing Good Gherkin&lt;/a&gt; or Paul Merrill's blog.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A title should be a short one-liner.&lt;/li&gt;
&lt;li&gt;When using conjunction words like "and", "or" and "but" be cautious since they imply that more than one action may be done.&lt;/li&gt;
&lt;li&gt;Avoid using conjunctions like "because", "since" and "so" since they explain why the scenario exists, while we should be concentrating on what the action is - why may be derived from the stages or described with comments.&lt;/li&gt;
&lt;li&gt;Avoid assertion language - don't use terms like "verify" "assert" or "should" since they focus on the statement rather than the action.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 5: To Make Your Life Easier, Install Plugins or Packages&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cJbVQ9-T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/720x245/c9a26d3146/step-5.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cJbVQ9-T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://a.storyblok.com/f/86602/720x245/c9a26d3146/step-5.jpeg" alt="Img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cucumber is easier to work with when you have the appropriate tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  Editors
&lt;/h3&gt;

&lt;p&gt;Gherkin syntax highlighting is supported by the majority of popular text editors.&lt;/p&gt;

&lt;p&gt;Advanced Cucumber support is available in certain IDEs, including the ability to run Cucumber from inside the IDE, view results, navigate between Gherkin phases, and so on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Atom
&lt;/h3&gt;

&lt;p&gt;It is a text editor for Windows, macOS, and Linux that offers several different packages to use with Gherkin.&lt;/p&gt;

&lt;h3&gt;
  
  
  TextMate
&lt;/h3&gt;

&lt;p&gt;It is a dedicated text editor for macOS to use with Gherkin. It helps boost the documentation process while developing scenarios.&lt;/p&gt;

&lt;h3&gt;
  
  
  Visual Studio Code
&lt;/h3&gt;

&lt;p&gt;It is not a text editor but a code editor specifically designed for Windows, macOS, and Linux. It can be used with a plugin with Gherkin Syntax.&lt;/p&gt;

&lt;h3&gt;
  
  
  IDEs
&lt;/h3&gt;

&lt;p&gt;IDEs is another plugin that can be used for different languages keeping as a plugin for Gherkin. There are different IDEs such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://cucumber.io/docs/tools/java#ides"&gt;Java IDEs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cucumber.io/docs/tools/ruby#ides"&gt;Ruby IDEs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://cuketest.com/"&gt;CukeTest&lt;/a&gt; tool&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Build Tools
&lt;/h3&gt;

&lt;p&gt;You can run Gherkin using build tools rather than from the command line.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://cucumber.io/docs/tools/java#build-tools"&gt;Java build tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cucumber.io/docs/tools/ruby#build-tools"&gt;Ruby build tools&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Gherkin is the cucumber specification format. Like YAML and Python, it is a line-oriented language that combines the human idea of cause and effect with the technical concept of input/process and output. It makes extensive use of the terms feature, background, scenario, given, when, then, and but.&lt;/p&gt;

&lt;p&gt;Gherkin is easy enough for non-programmers to comprehend. If you are looking for a team expert in Gherkin Syntax, don't hesitate to contact Selleo. We have Gherkin specialized developers to answer all your concerns. &lt;a href="https://selleo.com/contact"&gt;Contact us Now!&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Beginner's Guide To Gherkin</title>
      <dc:creator>Tomasz Jakobiec</dc:creator>
      <pubDate>Wed, 05 May 2021 08:15:16 +0000</pubDate>
      <link>https://dev.to/selleo/beginner-s-guide-to-gherkin-56kp</link>
      <guid>https://dev.to/selleo/beginner-s-guide-to-gherkin-56kp</guid>
      <description>&lt;p&gt;Good communication can not only improve the understanding of team members and positively influence their collaboration skills but also speed up the process of software development. Practices like Behaviour-Driven development influence the communication between the so-called ‘three amigos’ - business, development and testing.&lt;/p&gt;

&lt;p&gt;All that can be achieved by using the Gherkin language - one of the most popular languages for writing behaviour specifications. This article will serve you as a beginner guide to Gherkin. You will find out how to use it in practice and how it will help you improve your organisation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is BDD?
&lt;/h2&gt;

&lt;p&gt;Before diving into Gherkin, we need to focus on the basic rules of testing for a bit. One of those rules is Behaviour-Driven Development. BDD grew out of Test-Driven Development (TDD) and Acceptance Test-Driven Development (ATDD) and is a part of Agile software development processes that encourages collaboration among developers, QA and non-technical business participants in a software project.&lt;/p&gt;

&lt;p&gt;BDD focuses on identifying the desired behaviour of a given feature from the very beginning. The behaviour here means how a product or feature operates and is defined as a scenario of inputs, actions and outcomes.&lt;/p&gt;

&lt;p&gt;A product or feature has countless behaviours and identifying them brings clarity and simplicity. Those behaviour specs are written with realistic examples and serve as both the product’s requirements/acceptance criteria and its test cases after development. BDD aims to improve communication between team members, support clarity and minimise hand-overs. The key points of Behaviour-Driven Development are:&lt;/p&gt;

&lt;p&gt;BDD is a paradigm shift&lt;br&gt;
BDD focuses on behaviour first&lt;br&gt;
BDD is specification by example&lt;br&gt;
BDD is a refinement of the Agile process&lt;br&gt;
BDD also encourages applying the ‘Five Why’s’ principle to each user story to find a clear purpose for them. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is the Gherkin language?
&lt;/h2&gt;

&lt;p&gt;Gherkin is one of the most popular domain-specific languages for writing use cases for a software system in plain language. It promotes behaviour-driven development and allows developers, managers and business officials involved in the process to clearly understand the requirements of the project and the life-cycle. What is more, Gherkin’s text acts as documentation and skeleton of automated tests.&lt;/p&gt;

&lt;p&gt;The official Gherkin language standard is maintained by Cucumber - an open-source software testing tool that supports BDD. Cucumber works with Gherkin syntax structures because they are plain text making them easy to read. Cucumber reads Gherkin tests and validates the code checking if it performs as it should. Then, it creates a report showing if each step and scenario was successful.&lt;/p&gt;

&lt;p&gt;Read also: How To Streamline And Improve Your Process? 6 Steps To Follow&lt;/p&gt;

&lt;h2&gt;
  
  
  How are Gherkin test scenarios useful?
&lt;/h2&gt;

&lt;p&gt;Now you might be wondering why it is worth directing your attention towards Gherkin. How will it improve your communication and in return, the development process? Let’s discuss.&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits of BDD
&lt;/h3&gt;

&lt;p&gt;You should consider choosing Behaviour-Driven Development for several reasons and benefits like:&lt;/p&gt;

&lt;p&gt;clarity - scenarios focus on expected behaviours, which are described in plain language. Clarity ensures customers get what they want.&lt;br&gt;
automation - BDD makes turning scenarios into automated tests easy&lt;br&gt;
inclusion - it is all about collaboration, which means everybody from the customer to the tester is engaged in the product development process&lt;br&gt;
speed - BDD was designed to speed up the development since scenarios are requirements, acceptance criteria, test cases and test scripts all in one.&lt;br&gt;
momentum - BDD has a snowball effect - scenarios are easier and faster to write and automate as more definitions are added. They also often share common steps.&lt;br&gt;
shift left - ‘shift left testing’ means testing earlier in the development process, which results in fewer bugs later. &lt;br&gt;
artefacts - scenarios can form a collection of self-documenting test cases, which can be turned into a regression test suite.&lt;br&gt;
reusable code - some of the steps can be reused between scenarios. Automation coded becomes very modular.&lt;br&gt;
test-driven - BDD is an evolution of TDD. Creating scenarios from the beginning introduces quality-first and test-first mindset.&lt;br&gt;
variation - with scenario outlines it is easy to run the same scenario with different combinations of inputs, which is an amazing way to expand test coverage without code duplication&lt;br&gt;
parameterization - scenarios steps can be parametrized to be even more reusable. It is helpful for the team to adopt a common, reusable set of steps, which inspires healthier discussions when writing scenarios.&lt;br&gt;
adaptability - BDD scenarios are easy to update as the product changes&lt;br&gt;
Leverage QA standards to grow your business.&lt;br&gt;
Learn More →&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of Gherkin
&lt;/h3&gt;

&lt;p&gt;You might know the benefits of Behaviour-Driven development, but what about Gherkin? What are the advantages of using it? There are quite a few of them:&lt;/p&gt;

&lt;p&gt;simple even for non-programmers&lt;br&gt;
a solid base for tests&lt;br&gt;
it is easy to reuse code in other tests&lt;br&gt;
User Stories are simple to comprehend&lt;br&gt;
Gherkin Tests cases link acceptance tests directly to automated tests&lt;br&gt;
scripts can be easily understood by both business executives and developers&lt;br&gt;
Gherkin Testing targets business requirements&lt;br&gt;
Read also: How To Conduct End-To-End Testing In Endtest.io?&lt;br&gt;
In my opinion, the most important advantage of Gherkin is understandability:&lt;/p&gt;

&lt;p&gt;It is simple for everyone to understand (QA’s, developers and people not associated with programming or software in general) &lt;br&gt;
Gherkin script can easily be understood by business executives and developers (basically the same as above)&lt;br&gt;
Little to no previous experience is required in order to understand a small Gherkin command set&lt;br&gt;
What is more, using Gherkin means better communication, which leads to faster time-to-market and its test scenarios can be useful in many ways:&lt;/p&gt;

&lt;p&gt;As a simple documentation&lt;br&gt;
They help to track test automation coverage&lt;br&gt;
They can be used for test automation&lt;br&gt;
Fun fact: Gherkin language uses only 10 keywords, which makes it super easy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gherkin test basics
&lt;/h2&gt;

&lt;p&gt;Now let’s talk about Gherkin in practice. However, before you start writing, you should understand some Gherkin-related keywords:&lt;/p&gt;

&lt;h3&gt;
  
  
  Feature
&lt;/h3&gt;

&lt;p&gt;Gherkin documents start with this keyword, preceded by text that provides a description. Simply put, a feature is a description of what the software should be doing. It is also used to group scenarios together. The file should have a &lt;code&gt;.feature&lt;/code&gt; extension and each feature file should have only one feature.&lt;/p&gt;

&lt;p&gt;Note: Free-form description can also be written below the keywords as long as none of the lines starts with a keyword.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rule
&lt;/h3&gt;

&lt;p&gt;The ‘rule’ keyword represents one business rule that has to be included as it provides context for a feature. Keep in mind that those rules should have more than one scenario.&lt;/p&gt;

&lt;h3&gt;
  
  
  Given
&lt;/h3&gt;

&lt;p&gt;‘Given’ steps set the scene for the scenario. Most often they describe something that took place in the past. This gives the system context before users start interacting with it.&lt;/p&gt;

&lt;h3&gt;
  
  
  When
&lt;/h3&gt;

&lt;p&gt;‘When’ means action steps. It describes an event like one triggered by another system or a user interacting with it. Note that it is recommended to have only one ‘when’ step for each scenario.&lt;/p&gt;

&lt;h3&gt;
  
  
  Then
&lt;/h3&gt;

&lt;p&gt;‘Then’ is the outcome step. This is where you describe what the system is supposed to do. This should be something that can actually be seen as a result like a report or a message.&lt;/p&gt;

&lt;h3&gt;
  
  
  And, But
&lt;/h3&gt;

&lt;p&gt;They can be used when you have several of one of the step types. They help to keep the documentation readable and organized. ‘But’ keyword can easily be replaced by a properly used ‘And’, which helps to keep the number of keywords as low as possible and provides consistency throughout the test scenario.&lt;/p&gt;

&lt;h3&gt;
  
  
  Background
&lt;/h3&gt;

&lt;p&gt;The background allows adding more context to the scenarios in a ‘feature’. This is where you can provide more than one ‘given’ step.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario Outline
&lt;/h3&gt;

&lt;p&gt;This includes an examples section and can be read as a template. The scenario outline runs once for each of the example sections. &lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Behaviour-Driven Development is an amazing way to help your team communicate and collaborate better. As it focuses on the actual features’ behaviour it is great for testing APIs and web UIs. It helps to clarify requirements, discover new use-cases and make timely decisions. It also supports developers and encourages confidence. &lt;/p&gt;

&lt;p&gt;Gherkin is one of the most popular languages for writing behaviour specifications as it captures the ‘Given-When-Then’ scenarios. What is more, it makes it easy to turn those scenarios into automated test cases and is easy to understand.&lt;/p&gt;

&lt;p&gt;In the next post about Gherkin, we will go through the testing process and present how to write good tests, so keep your eyes peeled!&lt;/p&gt;

&lt;p&gt;If you are looking for a team of developers that know how to work with BDD or Gherkin and can take care of your project from start to finish, you are in the right place. Feel free to contact Selleo to discuss your idea further, get to know the team and start the development now!&lt;/p&gt;

</description>
      <category>gherkin</category>
      <category>testing</category>
      <category>bdd</category>
    </item>
  </channel>
</rss>
