---
title: 6 Best Practices for Gherkin
description: Six easy steps to improving clarity when using Gherkin.
image: https://blog.avenuecode.com/hubfs/office-1209640_640-1.jpg
---

[AvenueCode.com](https://avenuecode.com) [News](https://avenuecode.com/news) [Contact](https://avenuecode.com/contact)

[![Avenue Code Snippets Logo](https://blog.avenuecode.com/hubfs/Avenue%20Code%20New%20Logos%20-%202023/AC-Snippets---Black.png)](https://blog.avenuecode.com/?hsLang=en-us) *menu*

- Technology
  
  [Cloud](https://blog.avenuecode.com/blog/topic/cloud?hsLang=en-us) [Delivery Infrastructure](https://blog.avenuecode.com/blog/topic/delivery-infrastructure?hsLang=en-us) [Web Experience](https://blog.avenuecode.com/blog/topic/web-experience?hsLang=en-us) [Agile Mindset](https://blog.avenuecode.com/blog/topic/agile-mindset?hsLang=en-us) [Quality First](https://blog.avenuecode.com/blog/topic/quality-first?hsLang=en-us)
  
  [Design](https://blog.avenuecode.com/blog/topic/design?hsLang=en-us) [Solution Architecture](https://blog.avenuecode.com/blog/topic/solution-architecture?hsLang=en-us) [Data & ML](https://blog.avenuecode.com/blog/topic/data-and-machine-learning?hsLang=en-us) [Mobile Experience](https://blog.avenuecode.com/blog/topic/mobile-experience?hsLang=en-us)
- [Whitepapers](https://blog.avenuecode.com/blog/topic/whitepapers?hsLang=en-us)
- [Spotlight](https://blog.avenuecode.com/blog/topic/spotlight?hsLang=en-us)
- [Extraordinary Women in Tech](https://blog.avenuecode.com/blog/topic/extraordinary-women-in-tech?hsLang=en-us)
- [Avenue Code Culture](https://blog.avenuecode.com/blog/topic/avenue-code-culture?hsLang=en-us)

- [Cloud](https://blog.avenuecode.com/blog/topic/cloud?hsLang=en-us)
- [Design](https://blog.avenuecode.com/blog/topic/design?hsLang=en-us)
- [Delivery Infrastructure](https://blog.avenuecode.com/blog/topic/delivery-infrastructure?hsLang=en-us)
- [Solution Architecture](https://blog.avenuecode.com/blog/topic/solution-architecture?hsLang=en-us)
- [Web Experience](https://blog.avenuecode.com/blog/topic/web-experience?hsLang=en-us)
- [Data & ML](https://blog.avenuecode.com/blog/topic/data-and-machine-learning?hsLang=en-us)
- [Agile Mindset](https://blog.avenuecode.com/blog/topic/agile-mindset?hsLang=en-us)
- [Mobile Experience](https://blog.avenuecode.com/blog/topic/mobile-experience?hsLang=en-us)
- [Quality First](https://blog.avenuecode.com/blog/topic/quality-first?hsLang=en-us)
- [Whitepapers](https://blog.avenuecode.com/blog/topic/whitepapers?hsLang=en-us)
- [Spotlight](https://blog.avenuecode.com/blog/topic/spotlight?hsLang=en-us)
- [Extraordinary Women in Tech](https://blog.avenuecode.com/blog/topic/extraordinary-women-in-tech?hsLang=en-us)
- [Avenue Code Culture](https://blog.avenuecode.com/blog/topic/avenue-code-culture?hsLang=en-us)

# [6 Best Practices for Gherkin](https://blog.avenuecode.com/gherkin-best-practices)

- [Tweet](https://twitter.com/share)

*perm\_identity* [Leonardo Jorente](https://blog.avenuecode.com/gherkin-best-practices/author/leonardo-jorente?hsLang=en-us)

*schedule* 6/23/21 2:00 PM

Do you use Cucumber to support behavior-driven development? Check out these best practices for improving productivity and clarity.

##### What Will I Learn?

Today, we're going to present six simple and straightforward best practices to help you utilize Gherkin effectively. Before we do so, we'll review key concepts and explain why teams find Cucumber beneficial. 

##### **Behavior-Driven Development**

Cucumber's claim to fame is that it supports Behavior-Driven Development, or BDD. BDD is a collaborative process used by software teams  to mitigate the gaps between business and technical perspectives related to software requirements.

Following the Agile approach, the customer tells the business analyst/project owner about the needed feature. The business analyst then schedules a meeting with the developers and testers to discuss the feature to avoid misunderstandings. This meeting is called the Three Amigos Session.

How it Works

The business analyst/project owner defines the scope of the project and creates user stories for the feature;

The tester provides considerations related to edge test scenarios; and

The developer predicts possible technical challenges.

At the end of the meeting, the three collaboratively define the acceptance criteria examples (called scenarios), which are written using Gherkin.

##### **Gherkin**

Gherkin is a natural language that helps Cucumber to interpret and execute automated scripts. The syntax is used as living documentation for the project since the tests must always be updated. Because Gherkin is a natural language, it's easier for non-technical team members to understand the feature creation and testing process (especially when best practices are utilized). Gherkin is the language parser inside Cucumber.

##### **Cucumber**

Cucumber is a testing tool that supports the BDD approach using Gherkin. Cucumber is used to develop automation of the acceptance tests created.

##### Best Practices for Gherkin

Now that we've defined our key terms, let's cover the six best practices to write clear and effective scenarios using Gherkin. Some of these principles are self-explanatory, while others require more detailed elaboration.

1. Any given scenario should have only one GIVEN, one WHEN, and one THEN.

2. A maximum of two AND steps are allowed.

3. If a scenario requires more than five steps, try to split it into two different scenarios.

4. Reference the end user rather than using first person (I/we) in your tests.

For example, DO NOT WRITE:

Given I´m logged in  

When I create a new item...

Instead, DO WRITE:

Given the administrator is logged in

When the user creates a new item ...

5. Describe the specific flow and not every click.

For example, DO NOT WRITE:

Given the administrator opens the login page

And inserts user/password

And clicks the confirmation button

When the user opens the quick menu 

And selects the option create a new item

And fills all the fields

And clicks the confirmation button

Then a successful message appears

Instead, DO WRITE:

Given the administrator is logged in

When the user creates a new item

Then a successful message appears

6. Do not use technical terms in the Gherkin steps. Always try to keep absolute values in a configuration file.

For example, DO NOT WRITE:

Given the user is in the login page

When the user fills “user123” in the username field

And fills “Password123” in the password field

And clicks on button “OK”

Then the main page is displayed 

Instead, DO WRITE:

Given “administrator-user” goes to login screen

When the user logs in

Then the main page is displayed

##### Conclusion

If you follow these six best practices, you'll be well on your way to enabling better collaboration and clarity for everyone involved in the new feature design, which in turn will result in time savings for your team and a better experience for your end users.

 

##### References:

Giridhar Rajkumar, [Cucumber with Java - Test Automation University](https://testautomationu.applitools.com/cucumber-java-tutorial/)

[Gherkin Reference](https://cucumber.io/docs/gherkin/reference/)

---

### Author

# Leonardo Jorente

 Leonardo Jorente is a QA Test Engineer at Avenue Code. He brings eight years of experience in the field and is passionate about learning and sharing knowledge. In his free time, he enjoys nature walks, drawing, and spending time with family and friends.

---

### Related Posts

### Value Your Time: 11 Tips for More Efficient Meetings

[READ MORE](https://blog.avenuecode.com/tips-for-more-efficient-meetings?hsLang=en-us)

### Tips for Organizing Documentation in Agile Projects

[READ MORE](https://blog.avenuecode.com/tips-for-organizing-documentation-in-agile-projects?hsLang=en-us)

### Synergistic Digital Transformation: Potentiating Results with Systems Thinking

[READ MORE](https://blog.avenuecode.com/potentiating-results-with-systems-thinking?hsLang=en-us)

### How A/B Testing Can Transform Your Business

[READ MORE](https://blog.avenuecode.com/how-a/b-testing-can-transform-your-business?hsLang=en-us)

### Leave a Comment!

### Avenue Code Social

[![Facebook Icon](https://blog.avenuecode.com/hubfs/Images/Blog/facebook.png?t=1486470796564)](https://www.facebook.com/avenuecode)

[![Twitter Icon](https://blog.avenuecode.com/hubfs/Images/Blog/twitter.png?t=1486470796842)](https://twitter.com/AvenueCode)

[![LinkedIn Icon](https://blog.avenuecode.com/hubfs/Images/Blog/linkedin.png?t=1486470796556)](https://www.linkedin.com/company/avenuecode/)

### Newsletter

Want to stay on top of all tips and news from Avenue Code?

### Popular Snippets

![Avenue Code-primary versions_logo white avenue code endorsement 2](https://blog.avenuecode.com/hs-fs/hubfs/Avenue%20Code%20New%20Logos%20-%202023/Avenue%20Code-primary%20versions_logo%20white%20avenue%20code%20endorsement%202.png?width=1180&name=Avenue%20Code-primary%20versions_logo%20white%20avenue%20code%20endorsement%202.png "Avenue Code-primary versions_logo white avenue code endorsement 2")

### About Us

- [Who We Are](https://www.avenuecode.com/who-we-are)
- [What We Do](https://www.avenuecode.com/what-we-do)
- [Portfolio](https://www.avenuecode.com/portfolio)
- [Partners](https://www.avenuecode.com/partners)
- [News](https://www.avenuecode.com/news)
- [Events](https://www.avenuecode.com/events)
- [Blog](https://blog.avenuecode.com/)
- [Contact](https://www.avenuecode.com/contact)

### Our Offices

San Francisco

[+1 415 766 4178](tel:+553125161448) [ac.inquiries@avenuecode.com](mailto:brazil.info@avenuecode.com)

Belo Horizonte

[+55 31 2516 1448](tel:+553125161448) [brazil.info@avenuecode.com](mailto:brazil.info@avenuecode.com)

São Paulo

[+55 11 3205 3232](tel:+553125161448) [brazil.info@avenuecode.com](mailto:brazil.info@avenuecode.com)

### We're Hiring!

- [Belo Horizonte](https://www.avenuecode.com/who-we-are)
- [New York](https://www.avenuecode.com/what-we-do)
- [San Francisco](https://www.avenuecode.com/portfolio)
- [São Paulo](https://www.avenuecode.com/partners)

---

©2015 - 2017 Avenue Code

[![Facebook Icon](https://blog.avenuecode.com/hubfs/Images/Icons/facebook-2.png)](https://www.facebook.com/avenuecode) [![Twitter Icon](https://blog.avenuecode.com/hubfs/Images/Icons/twitter-2.png)](https://twitter.com/AvenueCode) [![LinkedIn Icon](https://blog.avenuecode.com/hubfs/Images/Icons/linkedin-2.png)](https://www.linkedin.com/company/avenue-code) [![Glassdoor Icon](https://blog.avenuecode.com/hubfs/Images/Icons/glassdoor-icon-1.png)](https://www.glassdoor.com/Overview/Working-at-Avenue-Code-EI_IE456173.11,22.htm) [![YouTube Icon](https://blog.avenuecode.com/hubfs/Images/Icons/youtube-2.png)](https://www.youtube.com/user/AvenueCodePlay)

Please enable JavaScript to view the [comments powered by Disqus.](http://disqus.com/?ref_noscript)

© 2026 Avenue Code

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Leonardo Jorente",
    "url" : "https://blog.avenuecode.com/author/leonardo-jorente"
  },
  "dateModified" : "2021-06-23T17:00:00.468Z",
  "datePublished" : "2021-06-23T17:00:00.000Z",
  "headline" : "6 Best Practices for Gherkin",
  "image" : [ "https://blog.avenuecode.com/hubfs/office-1209640_640-1.jpg" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.avenuecode.com/gherkin-best-practices",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.avenuecode.com/hubfs/Avenue%20Code%20New%20Logos%20-%202023/Avenue%20Code-primary%20versions_LOGO%20HORIZONTAL%20group%201-7.png"
    },
    "name" : "Avenue Code"
  }
}
```