Cuba at the threshold.

Cuba at the threshold., a Medium series by Camila Jurado

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Flexibility

The Cucumber Book, Second Edition — by Matt Wynne, Aslak Hellesøy, with Steve Tooke (40 / 136)

👈 Multiple Captures | TOC | Returning Results 👉

The readability of Cucumber features helps teams learn to use a ubiquitous language when talking about the system they’re building. This is a really important benefit, because that consistent use of terminology helps reduce misunderstandings and allow communication to flow more smoothly between everyone on the team.

So, we want to encourage our feature authors to be consistent about the nouns and verbs they use in the Cucumber features, because it helps make features that can be readily understood by anyone on the team. Equally, we also want feature authors to be able to express themselves as naturally as possible, which means they may often use slightly different phrasing to mean exactly the same thing. This is fine; in fact, it’s to be encouraged. Cucumber features are all about communicating with business users in their language, and it’s important that we don’t force them to sound like robots.

To keep the features readable and natural, it’s useful to develop the skill to make your step definitions flexible enough to match the different ways something might be expressed by a feature author. This isn’t as hard as you might think.

When matching business-facing Gherkin text, you’ll often want to indicate that you don’t care about the odd character in your match, such as when a word could be singular or plural:

Like the star and the plus, the question mark modifies the character that precedes it, specifying how many times it can be repeated. The question mark modifier means zero or one times; in other words, it makes the preceding character optional. In step definitions, it’s particularly useful for plurals:

By putting a question mark after the s in cucumbers, we’re saying that we don’t care whether the word is singular or plural. So, this step definition will match both of the previous steps.

You’ll find that the question mark comes in handy to knock off some rough edges from your step…

Add a comment

Related posts:

Sandboxing and Entitlements

Learn the critical tips and techniques to make using Xcode for the iPhone, iPad, or Mac easier, and even fun. Explore the features and functionality of Xcode you may not have heard of. Go under the hood to discover how projects really work, so when they stop working, you'll know how to fix them. Explore the common problems devel

7 ways I improve my mental health through nature

Taking the time to connect with nature can be an effective way to refresh yourself and thereby make stress and anxiety easier to deal with. Spending a few minutes or hours per week — however much…

10 Idea Techniques

Idea generation is at the heart of the design thinking process, I’m going to take you through the 10 most important idea generation techniques so you can start incorporating them into your design…