What is Give When Then?

GoRetro Team
May 13, 2023
Posted on
This is some text inside of a div block.

As a software developer, you might have heard about the Give When Then (GWT) acceptance criteria. It is a method of writing test scenarios that are easy to understand and manage. In this blog post, we will explore what GWT is, why teams use it, and how to use it effectively. We'll also look at some examples and discuss the GWT Gherkin language.

What is Give When Then?

GWT is a structured format for writing acceptance criteria for software features or user stories. It consists of three parts

  1. The given condition
  2. The when event
  3. The then expected outcome. 

In other words, it describes what the software should do when a certain condition is met, and what the expected outcome should be.

Here is an example of GWT acceptance criteria for a login feature:

  • Given a registered user with a valid email and password
  • When the user enters the correct email and password and clicks on the login button
  • Then the user should be logged in and directed to the homepage

Why Do Teams Use the Give When Then Framework?

There are several benefits of using GWT acceptance criteria. These include:

Shared Understanding

One of the main benefits of using the GWT framework is that it helps to ensure that the team has a shared understanding of what the feature should do. This is particularly important in Agile and Scrum methodologies, where collaboration and communication are key. By breaking down a feature into its constituent parts, the team can better understand what the software should do and what the expected outcome should be. This can reduce misunderstandings and ensure that everyone is on the same page.

Automated Testing

Another benefit of using the GWT framework is that it can make it easier to write automated tests. Automated tests can save a lot of time and effort in the long run, but they require clear and unambiguous acceptance criteria. By using the GWT format, the acceptance criteria can be easily translated into automated tests. This can help to ensure that the software behaves as expected and can help to catch bugs and errors before they reach production.

Early Identification of Requirements Issues

GWT can also help to identify missing or incomplete requirements early on in the development process. By breaking down a feature into its constituent parts, it can be easier to spot any gaps or inconsistencies. This can be particularly helpful in Agile and Scrum methodologies, where the development process is iterative and requirements can change frequently.

Collaboration

Using the GWT framework can also help to foster collaboration among team members. GWT acceptance criteria should be created collaboratively with the whole team, including developers, testers, and stakeholders. This can help to ensure that everyone is aligned and that there are no misunderstandings. By working together to create acceptance criteria, team members can also gain a better understanding of each other's roles and responsibilities.

Clear Communication

Finally, using the GWT framework can improve communication within the team and with stakeholders. By using a structured format, the acceptance criteria can be easily understood by everyone, regardless of their technical expertise. This can help to ensure that everyone is on the same page and that there are no misunderstandings. Clear communication can also help to build trust and confidence among team members and stakeholders.

How to Use Give When Then Acceptance Criteria?

To use GWT acceptance criteria effectively, it's important to follow a few guidelines:

Start with user stories: GWT acceptance criteria should be based on user stories, which describe the feature from the perspective of the end-user.

Keep it simple: GWT acceptance criteria should be easy to understand and manage. Avoid using complex language or convoluted scenarios.

Be specific: GWT acceptance criteria should be specific and unambiguous. Use concrete examples to illustrate the expected behavior of the software.

Collaborate: GWT acceptance criteria should be created collaboratively with the whole team, including developers, testers, and stakeholders. This can help to ensure that everyone is aligned and that there are no misunderstandings.

GWT Gherkin Language

The GWT acceptance criteria can be written in any format, but the most popular is Gherkin, a language that uses a syntax similar to natural language. Here's an example of the previous login feature written in Gherkin:

Feature: Login

  Scenario: Successful login

    Given a registered user with a valid email and password

    When the user enters the correct email and password and clicks on the login button

    Then the user should be logged in and directed to the homepage

In this format, the feature is defined at the top, followed by one or more scenarios that describe the acceptance criteria.

Conclusion

Give When Then acceptance criteria is a simple yet powerful tool for writing clear and unambiguous acceptance criteria for software features. By breaking down a feature into its constituent parts, it can help to ensure that everyone is on the same page, make it easier to write automated tests, and identify missing or incomplete requirements early on in the development process. By following some simple guidelines and using a structured format like Gherkin, you can use GWT acceptance criteria to improve the quality of your software development process.

Join thousands of companies

Start for free - update any time
Joining as an organisation? Contact sales