3

I'm relatively new to the acceptance criteria in GWT format, and I'm struggling with writing them for the features that involve reviewing content. For instance: the user is on the home page of e-commerce website, and reviews the items being sold on that website.

My user story looks like this: As a User, I want to view the available products so that I can find the one I want to buy. But what about acceptance criteria? I've come up with the "Given" part (Given I've navigated to the system home page) and "Then" part (Then I'm able to view the available products) - however, "When" is a mystery for me. What is that trigger that moves the user from "Given" to "Then? Maybe I'm just totally wrong with "Given"/"Then" parts?

I've tried to google that, but it seems like either my requests are clumsy or it's not that big problem for everyone else.

Thank you in advance and sorry if it's been posted before :)

3 Answers 3

2

You stumbled upon the main problem of GWT format - it's too verbose. Especially for simple requirements. If you really want to stick with this format, here's a possibility:

Given products are registered by administrator
When user navigates to home page
Then he sees recently added products

If you're allowed to be creative, you can also take shortcuts and get rid of Given step:

When user navigates to home page
Then he sees recently registered products

Given is what testers would call a pre-condition, it's not mandatory.

2

We should start with this: Acceptance Criteria do not need to be in the GWT format.

GWT, as part of Behavior-Driven Development, was specifically meant to describe expected behavior. Some clear examples of where GWT is a perfect fit might be:

Given I am logged in as an authorized user 
And I have a list of products 
When I delete a product 
Then the product is no longer in the list
Given I am not logged in as a permission-limited user 
And I have a list of products 
When I delete a product 
Then the product is still in the list 
And the operation fails with an error "X"

However, if we are just talking about something like data presentation, a bulleted list of expected fields or a picture of a whiteboard sketch is probably much better.

4
  • 1
    GWT format was not created for Acceptance Criteria - actually that's not true.. This format was created as a tool for collaboration of BAs, QAs and Developers. See dannorth.net/introducing-bdd: "we were trying to define a ubiquitous language for the analysis process itself!", and "The template had to be loose enough that it wouldn’t feel artificial or constraining to analysts but structured enough that we could break the story into its constituent fragments and automate them" Commented Jun 17, 2020 at 21:40
  • Thank you for the fact check. I stand corrected. I will adjust my answer accordingly.
    – Daniel
    Commented Jun 17, 2020 at 22:09
  • It is worth noting that he makes some statements in the article about acceptance criteria that are not universally accepted. In particular, he states that acceptance criteria should be executable. As he has no claim to the term, that statement does not have more (or less) validity than other experts on the topic that would allow non-executable acceptance criteria.
    – Daniel
    Commented Jun 17, 2020 at 22:16
  • He also refers to DDD's ubiquitous language as an inspiration for BDD, but BDD provides ubiquitous template (not language). And the whole idea of BDD is not universally accepted either.. BAs who write tons of extra lines just to easily automate tests, which most likely will be automated on the highest possible level (which in turn is bad for maintainability and performance) by people who aren't really able to write code (that wasn't a part of the ideology, but it turned out this way).. I like the idea of naming tests meaningfully, but that idea shouldn't have gotten further than that. Commented Jun 17, 2020 at 22:38
1

The idea with Given-When-Then, is that you split your acceptance criteria into tiny pieces that can then be executed. That means an action (when) and an expected outcome (then). You perform these actions and checks in a context (given). In your case you are actually missing the context because you are loading the home page.

Your acceptance test should be something like:

WHEN I load the homepage
THEN I should see the items being sold

See the explanations on this similar question: Given When Then Testing - Do I NEED a “When”?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.