Things I Learnt The Hard Way - Gherkin Is Your Friend to Understand Expectations

Gherkin is file format for writing behaviour tests (BDD). But it can also give you some insights on what you should do.

Alright, let's talk a bit about Gherkin:

Gherkin is a file format created for Cucumber, which describes scenarios, what's in them, what actions the user/system will do and what's expected after those actions, in a very high level, allowing people without programming experience can describe what's expected from the system.

Although Gherkin was born with Cucumber, it is now supported by a bunch of programming languages, through external libraries.

A typical Gherkin file may look something like this:

Or, in a more concrete example:

Pretty simple, right?

Now, why I'm mentioning this?

Sometimes, specs are not the most clear source of information about what it is expected from the system, and up can't think of steps to do so. If you're confused about what you should write, asking the person responsible for the request to write something like Gherkin may give you some better insights about it.

Obviously, it won't be complete. People tend to forget the error situations -- like filling the name field with numbers, using characters in age fields, tweets with no text and just attachments -- but at least with a Gherkin description of the system, you can get a better picture of the whole.

Also, you may not like to write specs. That's alright, you can replace them with Gherkin anyway.

<< Write Steps as Comments
Design Patters Are Used to Name Solution, Not Find Them >>