<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://cucumber.io/blog</id>
    <title>Cucumber Blog</title>
    <updated>2026-03-30T00:00:00.000Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <link rel="alternate" href="https://cucumber.io/blog"/>
    <subtitle>Cucumber Blog</subtitle>
    <icon>https://cucumber.io/img/logo.svg</icon>
    <entry>
        <title type="html"><![CDATA[Cucumber in 2025, year in review]]></title>
        <id>https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review</id>
        <link href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review"/>
        <updated>2026-03-30T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[A year ago, Cucumber returned to community ownership.]]></summary>
        <content type="html"><![CDATA[<p>A year ago, Cucumber <a href="https://cucumber.io/blog/open-source/cucumber-is-back-in-community-ownership" target="_blank" rel="noopener noreferrer" class="">returned to community ownership</a>.
I'd like to take a moment to reflect on what we have been up to.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="notable-changes">Notable changes<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#notable-changes" class="hash-link" aria-label="Direct link to Notable changes" title="Direct link to Notable changes" translate="no">​</a></h2>
<p>Cucumber is a collection of different implementations. Each moves at the speed
of its contributors and maintainers. So we start by highlight some changes from
the individual projects.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="cucumber-jvm">Cucumber JVM<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#cucumber-jvm" class="hash-link" aria-label="Direct link to Cucumber JVM" title="Direct link to Cucumber JVM" translate="no">​</a></h3>
<p>In 2025, we've had 20 releases for Cucumber-JVM. These were mostly bug fixes
and dependency updates. But I'd like to highlight a few notable changes.</p>
<ul>
<li class="">
<p>We had <a href="https://github.com/cucumber/cucumber-jvm/pull/3124" target="_blank" rel="noopener noreferrer" class="">a contribution</a>
from Stefan Gasterstädt to make it possible to create locale sensitive
parameter transformers. This looked quite complicated at the start, but the
actual implementation turned out to be incredibly elegant.</p>
</li>
<li class="">
<p>Julien Kronegg contributed several<sup>
<a href="https://github.com/cucumber/gherkin/pull/372" target="_blank" rel="noopener noreferrer" class="">1</a>,
<a href="https://github.com/cucumber/cucumber-jvm/pull/2971" target="_blank" rel="noopener noreferrer" class="">2</a>,
<a href="https://github.com/cucumber/cucumber-jvm/pull/2703" target="_blank" rel="noopener noreferrer" class="">3</a>,
<a href="https://github.com/cucumber/gherkin/pull/445" target="_blank" rel="noopener noreferrer" class="">4</a></sup> performance
improvements.</p>
</li>
<li class="">
<p>The Cucumber JUnit Platform Engine now <a href="https://github.com/cucumber/cucumber-jvm/pull/3057" target="_blank" rel="noopener noreferrer" class="">supports rerun files</a>.
While the solution comes with a bunch of jankiness, it should smooth out the
upgrade path from JUnit 4 to Junit 5+.</p>
</li>
<li class="">
<p>With JUnit 4 entering maintenance mode <a href="https://github.com/cucumber/cucumber-jvm/tree/main/cucumber-junit" target="_blank" rel="noopener noreferrer" class="">cucumber-junit</a>
has been deprecated in favor of <a href="https://github.com/cucumber/cucumber-jvm/tree/main/cucumber-junit-platform-engine" target="_blank" rel="noopener noreferrer" class="">cucumber-junit-platform-engine</a>.</p>
</li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="cucumber-js">Cucumber JS<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#cucumber-js" class="hash-link" aria-label="Direct link to Cucumber JS" title="Direct link to Cucumber JS" translate="no">​</a></h3>
<p>In 2025, we've made 8 releases for Cucumber-JS. These were mostly bug fixes,
and small features, but we did make some architectural moves to enable bigger
things. Some notable changes:</p>
<ul>
<li class="">Alexandru Gologan contributed <a href="https://github.com/cucumber/cucumber-js/pull/2600" target="_blank" rel="noopener noreferrer" class="">support for execution sharding</a>.</li>
<li class="">Configuration files <a href="https://github.com/cucumber/cucumber-js/pull/2709" target="_blank" rel="noopener noreferrer" class="">can be written in TypeScript</a>.</li>
<li class="">You can now write <a href="https://github.com/cucumber/cucumber-js/blob/main/docs/plugins.md" target="_blank" rel="noopener noreferrer" class="">plugins to augment built-in behaviour</a></li>
</ul>
<p>We're also working on <a href="https://github.com/cucumber/cucumber-node" target="_blank" rel="noopener noreferrer" class=""><code>@cucumber/node</code></a>
built around the <a href="https://nodejs.org/api/test.html" target="_blank" rel="noopener noreferrer" class="">Node.js test runner</a>. It's
still in the pre-1.0.0 phase, so APIs and behaviour might change. The stable
canonical implementation of Cucumber for JavaScript continues to be
<a href="https://github.com/cucumber/cucumber-js" target="_blank" rel="noopener noreferrer" class="">@cucumber/cucumber</a> for now.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="cucumber-ruby">Cucumber Ruby<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#cucumber-ruby" class="hash-link" aria-label="Direct link to Cucumber Ruby" title="Direct link to Cucumber Ruby" translate="no">​</a></h3>
<p>In 2025 Cucumber-Ruby turned Seventeen! Which means it is now
<a href="https://github.com/cucumber/cucumber-ruby/commits/f3292f4023a707099d02602b2bd6c4ca3cec6820" target="_blank" rel="noopener noreferrer" class="">old enough to drive</a>
in some parts of the world. It also saw 5 releases including v10.0.0 which
lays some of the groundwork for upcoming architectural changes.</p>
<p>More visibly, support for Ruby 2.7 and 3.0 was removed and support for Ruby 4.0+
was added. The minimum supported Ruby version is now 3.1.</p>
<p>Thanks to Jérôme Lipowicz dependencies on default gems in stdlib are
now explicitly declared. Backtrace filtering is now much more robust to handle
a lot of the internal ruby changes, but ideally you won't see any of that.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="cucumber-messages">Cucumber Messages<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#cucumber-messages" class="hash-link" aria-label="Direct link to Cucumber Messages" title="Direct link to Cucumber Messages" translate="no">​</a></h3>
<p><a href="https://github.com/cucumber/messages" target="_blank" rel="noopener noreferrer" class="">Cucumber Messages</a> is a schema to
describe test results and other information from Cucumber in a new-line
delimited JSON format. The first commit was done in 2018, and we are now at the
point that we can dogfood our own implementation and build up the documentation
and tooling through that.</p>
<p>For users the first results can be seen in the
<a href="https://github.com/cucumber/pretty-formatter" target="_blank" rel="noopener noreferrer" class="">pretty formatter</a>
and <a href="https://github.com/cucumber/html-formatter" target="_blank" rel="noopener noreferrer" class="">HTML formatter</a> which now
create reports with more fidelity.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="cucumber-json-report-in-maintenance-mode">Cucumber JSON Report in maintenance-mode<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#cucumber-json-report-in-maintenance-mode" class="hash-link" aria-label="Direct link to Cucumber JSON Report in maintenance-mode" title="Direct link to Cucumber JSON Report in maintenance-mode" translate="no">​</a></h3>
<p>With the internal adoption of messages now in progress we have now also
officially put the Cucumber JSON report in maintenance mode. The format is still
supported but will not receive any changes. We don't expect this will have any
significant impact, in practice the format had already been ossified.</p>
<p>Putting the format in maintenance mode meant that we had to pin down the
exact format of the report in the form of the <a href="https://github.com/cucumber/cucumber-json-schema" target="_blank" rel="noopener noreferrer" class="">cucumber-json-schema</a>.
Unfortunately there been a significant drift between implementations and each
flavor will need its own schema. So this is very much a work in progress, but
for Cucumber-JVM at least that work is now completed.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="reqnroll">Reqnroll<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#reqnroll" class="hash-link" aria-label="Direct link to Reqnroll" title="Direct link to Reqnroll" translate="no">​</a></h3>
<p>While <a href="https://reqnroll.net/" target="_blank" rel="noopener noreferrer" class="">Reqnroll</a> isn't under Cucumber umbrella, I would
be amiss if I didn't find a way to highlight Chris Rudolphi's contributions.</p>
<p>Chris has been driving the adoption of Cucumber messages in Reqnroll and as part
of that made numerous contributions to Cucumber. Including .NET implementations
of tag-expressions, html-formatter and compatibility-kit.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="organizational-stuff">Organizational stuff<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#organizational-stuff" class="hash-link" aria-label="Direct link to Organizational stuff" title="Direct link to Organizational stuff" translate="no">​</a></h2>
<p>We created a <a href="https://github.com/cucumber/governance/" target="_blank" rel="noopener noreferrer" class="">governance repository</a> to
describe who we are and how we are organized and operate. This was rather boring
to do but also essential to acquire funding and sponsorships.</p>
<p>Additionally, we have set up a <a href="https://github.com/cucumber/.github/blob/main/SECURITY.md" target="_blank" rel="noopener noreferrer" class="">security policy</a>
to let people know how to contact us in case of security issues.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="newsletter">Newsletter<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#newsletter" class="hash-link" aria-label="Direct link to Newsletter" title="Direct link to Newsletter" translate="no">​</a></h2>
<p>We're finally reviving our mailing list. If you're reading this in your email
client, that means we've got it all working again.</p>
<p>If not, you can subscribe <a href="https://cucumber.io/community" target="_blank" rel="noopener noreferrer" class="">here</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="finances">Finances<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#finances" class="hash-link" aria-label="Direct link to Finances" title="Direct link to Finances" translate="no">​</a></h2>
<p>Cucumber is currently funded through donations from Open Collective, GitHub
Sponsors, and Thanks.dev. We have also partnered with Tidelift and collect some
ad revenue through Ethical Ads. In total, we received $65,545.63 with the
majority coming from Tidelift.</p>





































<table><thead><tr><th>Source</th><th style="text-align:right">2025 Income</th></tr></thead><tbody><tr><td>Tidelift</td><td style="text-align:right">$52,900.00</td></tr><tr><td>Open Collective</td><td style="text-align:right">$7,784.50</td></tr><tr><td>GitHub Sponsors</td><td style="text-align:right">$4,047.96</td></tr><tr><td>Ethical Ads</td><td style="text-align:right">$768.50</td></tr><tr><td>Thanks.dev</td><td style="text-align:right">$44.67</td></tr><tr><td></td><td style="text-align:right">--------- +</td></tr><tr><td>Total</td><td style="text-align:right">$65,545.63</td></tr></tbody></table>
<p>On the expense side we spent $69.960,28 resulting in a small loss of $4,414.65
Fortunately we already built up some buffer in 2024 to absorb the loss.</p>





























<table><thead><tr><th>Destination</th><th style="text-align:right">2025 Expenses</th></tr></thead><tbody><tr><td>Maintenance and Development</td><td style="text-align:right">$67,842.15</td></tr><tr><td>Payment Processor Fees</td><td style="text-align:right">$1,588.31</td></tr><tr><td>Hosting and Subscriptions</td><td style="text-align:right">$529.82</td></tr><tr><td></td><td style="text-align:right">----------- +</td></tr><tr><td>Total</td><td style="text-align:right">$69.960,28</td></tr></tbody></table>
<p>The biggest expense was the maintenance and development of Cucumber. While
number looks big in absolute terms, we try to compensate our maintainers fairly.
So at market rates this comes down to about a cumulative 13-16 hours a week.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="sponsor-cucumber">Sponsor Cucumber!<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#sponsor-cucumber" class="hash-link" aria-label="Direct link to Sponsor Cucumber!" title="Direct link to Sponsor Cucumber!" translate="no">​</a></h2>
<p>The development of Cucumber is made possible by you - our users. We try to
handle pull- and feature-requests, keep up to date with the latest versions,
and respond to bugs and issues. And all of that in a timely manner.</p>
<p>Your support would enable us to do this with more focus and consistency rather
than weekends and our spare time.</p>
<p>You can sponsor us through <a href="https://cucumber.io/sponsors" target="_blank" rel="noopener noreferrer" class="">Open Collective</a> or
<a href="https://github.com/sponsors/cucumber" target="_blank" rel="noopener noreferrer" class="">GitHub Sponsors</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="get-involved">Get involved<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#get-involved" class="hash-link" aria-label="Direct link to Get involved" title="Direct link to Get involved" translate="no">​</a></h2>
<p>We like to think Cucumber is a warm and friendly community where you can make
friends and learn, building software that thousands of people rely on every day.</p>
<p>You can find us on <a href="https://discord.gg/8YXBH8j74w" target="_blank" rel="noopener noreferrer" class="">Discord</a>,
<a href="https://github.com/orgs/cucumber/discussions" target="_blank" rel="noopener noreferrer" class="">GitHub Discussions</a> or feed the
robots on <a href="https://stackoverflow.com/questions/tagged/cucumber" target="_blank" rel="noopener noreferrer" class="">Stack Overflow</a>.</p>
<p>We have a regular meeting on <a href="https://cucumber.github.io/community-calendar/calendar.ics" target="_blank" rel="noopener noreferrer" class="">Thursdays</a>
at 4pm London time.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="thanks">Thanks<a href="https://cucumber.io/blog/open-source/cucumber-in-2025-year-in-review#thanks" class="hash-link" aria-label="Direct link to Thanks" title="Direct link to Thanks" translate="no">​</a></h2>
<p>One year later on I'm elated to see the Cucumber project is still alive, active
and developing. Thanks for being part of this community. It's an amazing
privilege to be part of such a vibrant, popular open source project.</p>]]></content>
        <author>
            <name>Rien Korstanje</name>
            <uri>https://logarithmicwhale.com</uri>
        </author>
        <author>
            <name>Matt Wynne</name>
            <uri>https://mattwynne.net</uri>
        </author>
        <category label="Open Source" term="Open Source"/>
        <category label="Year in Review" term="Year in Review"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Cucumber is back in Community Ownership]]></title>
        <id>https://cucumber.io/blog/open-source/cucumber-is-back-in-community-ownership</id>
        <link href="https://cucumber.io/blog/open-source/cucumber-is-back-in-community-ownership"/>
        <updated>2024-12-19T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Today is a big day for Cucumber.]]></summary>
        <content type="html"><![CDATA[<p>Today is a big day for Cucumber.</p>
<p>6099 days since <a href="https://github.com/cucumber/cucumber-ruby/commit/f3292f4023a707099d02602b2bd6c4ca3cec6820" target="_blank" rel="noopener noreferrer" class="">the project was first started</a>, 4158 days since we <a href="https://cucumber.io/blog/news/cucumber-limited/" target="_blank" rel="noopener noreferrer" class="">formed Cucumber Ltd</a>, and 2004 days since <a href="https://cucumber.io/blog/news/cucumber-acquired-by-smartbear/" target="_blank" rel="noopener noreferrer" class="">SmartBear acquired Cucumber Ltd</a> we have entered a new and exciting phase: Cucumber is back in community ownership.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-is-happening-today">What is happening today?<a href="https://cucumber.io/blog/open-source/cucumber-is-back-in-community-ownership#what-is-happening-today" class="hash-link" aria-label="Direct link to What is happening today?" title="Direct link to What is happening today?" translate="no">​</a></h2>
<p>What this means technically is that the intellectual property assets (the <code>cucumber.io</code> domain where this blog is hosted, the name trademarks and brand etc.) are transitioning from the ownership of SmartBear Software, into the <a href="https://oscollective.org/" target="_blank" rel="noopener noreferrer" class="">Open Source Collective</a> (OSC).</p>
<p>OSC is a 501(c)(6) non-profit registered in the USA, providing a similar service to open source projects as other foundations like the <a href="https://www.apache.org/" target="_blank" rel="noopener noreferrer" class="">Apache Software Foundation</a>, <a href="https://www.linuxfoundation.org/" target="_blank" rel="noopener noreferrer" class="">Linux Foundation</a> or <a href="https://sfconservancy.org/" target="_blank" rel="noopener noreferrer" class="">Software Freedom Conservancy</a>. With control of the name and domain back in the hands of the community, we will be able to move the project forward independently, free from the commercial priorities of any single organisation.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-does-this-mean-for-me">What does this mean for me?<a href="https://cucumber.io/blog/open-source/cucumber-is-back-in-community-ownership#what-does-this-mean-for-me" class="hash-link" aria-label="Direct link to What does this mean for me?" title="Direct link to What does this mean for me?" translate="no">​</a></h2>
<p>Since February 2023, when SmartBear and I began exploring new paths for the project, the process introduced a period of uncertainty for those of us closest to it. We worked closely with SmartBear to navigate the legal details surrounding the name, and while that process took time, it also reflected a shared commitment to finding the best outcome for the project and its community.</p>
<p>If you're using one of the many open-source flavours of Cucumber like <a href="https://github.com/cucumber/cucumber-jvm" target="_blank" rel="noopener noreferrer" class="">Cucumber-JVM</a>, <a href="https://github.com/cucumber/cucumber-js" target="_blank" rel="noopener noreferrer" class="">Cucumber-JS</a> or <a href="https://github.com/cucumber/cucumber-ruby" target="_blank" rel="noopener noreferrer" class="">Cucumber-Ruby</a> you can now be confident knowing that the core team can focus 100% of their time on evolving those products to meet your needs.</p>
<p>This also means it may be time for you to take a more active role in ensuring the long-term health of the project. Yes, you! Folks like <a href="https://www.linkedin.com/in/davidjgoss/" target="_blank" rel="noopener noreferrer" class="">David Goss</a>, <a href="https://www.linkedin.com/in/mpkorstanje/" target="_blank" rel="noopener noreferrer" class="">Rien Korstanje</a>, and <a href="https://www.linkedin.com/in/i-am-luke-hill/" target="_blank" rel="noopener noreferrer" class="">Luke Hill</a> work hard to keep Cucumber going. Here's how you can help them.</p>
<ul>
<li class="">
<p><strong>Get involved in the community</strong>: <a href="https://cucumber.io/community" target="_blank" rel="noopener noreferrer" class="">Join our Discord</a> to chat with other users and contributors. Even just supporting other users with their questions is a great way to contribute; it’s how I got started!</p>
</li>
<li class="">
<p><strong>Sponsor the project</strong>: Maintaining a thriving open-source project takes time, effort, and resources. If Cucumber has made a difference for you or your team, consider making a financial contribution through our <a href="https://cucumber.io/sponsors" target="_blank" rel="noopener noreferrer" class="">sponsorship program</a>. Your support will ensure we can keep Cucumber sustainable, growing, and improving for years to come.</p>
</li>
</ul>
<p>Our financials are <a href="https://opencollective.com/cucumber#category-BUDGET" target="_blank" rel="noopener noreferrer" class="">completely transparent</a>. We try to pay our contributors fairly for their time, and we also need resources for hosting and other operational costs.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="a-note-of-thanks">A note of thanks<a href="https://cucumber.io/blog/open-source/cucumber-is-back-in-community-ownership#a-note-of-thanks" class="hash-link" aria-label="Direct link to A note of thanks" title="Direct link to A note of thanks" translate="no">​</a></h2>
<p>I want to acknowledge the support that SmartBear has provided over the years, helping Cucumber grow and reach new audiences. It was brave of them to take a chance on us back in 2019 and I'm grateful that their folks have done the work to see this through and transition stewardship back to the community. I think it demonstrates their integrity and appreciation of open source culture.</p>]]></content>
        <author>
            <name>Matt Wynne</name>
            <uri>https://mattwynne.net</uri>
        </author>
        <category label="Open Source" term="Open Source"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[BDD, approval testing, and VisualTest]]></title>
        <id>https://cucumber.io/blog/bdd/bdd-approval-testing-and-visualtest</id>
        <link href="https://cucumber.io/blog/bdd/bdd-approval-testing-and-visualtest"/>
        <updated>2023-02-08T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[This blog post explores the challenges of applying a Behavior-Driven Development (BDD) approach to UI development using VisualTest. In addition to giving a high-level introduction to BDD, I’ll describe a technique called Approval Testing that complements traditional assertion-based testing to give developers clearer visibility of the correctness of their implementation.]]></summary>
        <content type="html"><![CDATA[<p>This blog post explores the challenges of applying a Behavior-Driven Development (BDD) approach to UI development using VisualTest. In addition to giving a high-level introduction to BDD, I’ll describe a technique called Approval Testing that complements traditional assertion-based testing to give developers clearer visibility of the correctness of their implementation.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-is-bdd">What is BDD?<a href="https://cucumber.io/blog/bdd/bdd-approval-testing-and-visualtest#what-is-bdd" class="hash-link" aria-label="Direct link to What is BDD?" title="Direct link to What is BDD?" translate="no">​</a></h2>
<p>BDD is an agile development approach in which three practices are applied to each story/backlog item: Discovery, Formulation, and Automation. Much has been <a href="https://bddbooks.com/" target="_blank" rel="noopener noreferrer" class=""><strong>written</strong></a> about BDD and there are many good <a class="" href="https://cucumber.io/blog/tags/bdd"><strong>introductory articles</strong></a> available, but here I’d like to stress that these practices must be applied in the correct order. Discovery, then Formulation, then Automation.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/f0cc3c65859ca842c2d58cd31bd5fa40ee7f5594b4a71dd1dcbd151eb02affce-cd36fe8d82bdc575c99fd8b6fee2e601.png" width="1315" height="818" class="img_ev3q"></p>
<p><a class="" href="https://cucumber.io/docs/bdd">https://cucumber.io/docs/bdd</a></p>
<p>In the context of BDD, Automation means the writing of test code before the code under test has been written. Just like Test-Driven Development (TDD), the failing automated test drives the development of the production code. There are two implications of this approach:</p>
<ul>
<li class="">Every test should be seen to fail when it is written and seen to pass when the correct production code is implemented. Never trust a test that you haven’t seen fail.</li>
<li class="">The automation code must be written either by the people who will write the production code or by someone who is collaborating very closely with them.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="should-automation-be-end-to-end">Should automation be end-to-end?<a href="https://cucumber.io/blog/bdd/bdd-approval-testing-and-visualtest#should-automation-be-end-to-end" class="hash-link" aria-label="Direct link to Should automation be end-to-end?" title="Direct link to Should automation be end-to-end?" translate="no">​</a></h2>
<p>There’s a common misconception that all BDD scenarios will be automated end to end, exercising the entire application stack. Since each BDD scenario is only intended to specify a single business behavior, using an end-to-end approach for each one would be incredibly wasteful:</p>
<ul>
<li class="">Runtime – end-to-end tests take longer to run than tests that exercise specific areas of the code.</li>
<li class="">Noise – the more of the code each test exercises, the more likely it is that many tests will all hit the same code paths. So, an error in that code path will cause all the tests that use it to fail, even if that part of the code has nothing to do with the business behavior the scenario was created to specify. In the face of multiple failing scenarios, it’s hard to diagnose which behavior has deviated from specification.</li>
</ul>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/909149ef6ed2be5eefa5cc79cb4de1c06b2073038ec653bb21e9b0fb085624c3-d8ae9f71b6b35bb214d33c0c603677b0.png" width="1433" height="942" class="img_ev3q"><a class="" href="https://cucumber.io/blog/bdd/eviscerating-the-test-automation-pyramid/">https://cucumber.io/blog/bdd/eviscerating-the-test-automation-pyramid/</a></p>
<p>The <strong>Test Automation Pyramid</strong> is a common metaphor that suggests most tests should not be end to end. Applying this approach to BDD automation means that we should consider the most appropriate automation to ensure that a specific behavior has been implemented as specified.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="how-should-the-ui-be-tested">How should the UI be tested?<a href="https://cucumber.io/blog/bdd/bdd-approval-testing-and-visualtest#how-should-the-ui-be-tested" class="hash-link" aria-label="Direct link to How should the UI be tested?" title="Direct link to How should the UI be tested?" translate="no">​</a></h2>
<p>BDD scenarios that describe how the UI should behave are usually written using tools such as Selenium. These can be slow and brittle because the UI is often tightly coupled with the rest of the application. However, conceptually, the UI is a component that interacts with other application components. It should therefore be possible to test the UI in isolation, near the bottom of the Test Automation Pyramid, by providing test doubles for the application components that it depends on.</p>
<p>Many applications are architected in such a way that the UI can only be exercised as part of an end-to-end test. Whenever possible, a more flexible architecture (that allows the UI to be exercised with the rest of the application “stubbed out”) should be preferred.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="is-that-all">Is that all?<a href="https://cucumber.io/blog/bdd/bdd-approval-testing-and-visualtest#is-that-all" class="hash-link" aria-label="Direct link to Is that all?" title="Direct link to Is that all?" translate="no">​</a></h2>
<p>Even with a flexible architecture and automation that conforms to the Test Automation Pyramid, there are challenges. Most test frameworks come with simple assertion libraries that verify if text or numerical values are set as expected. If you need to validate all the fields in a report, you will need an assertion for each of them. This approach leads to verbose automation code that is time consuming to write and difficult to maintain. Additionally, as soon as one assertion fails, the whole test fails without checking any subsequent assertions.</p>
<p>For many years, a technique called Approval Testing has been used in these situations, and several tools have been developed to help teams incorporate approval testing into their software development processes. The mechanics of how the tools work vary, but their approach is the same:</p>
<ol>
<li class="">The first time the test is run, the output is checked manually. If correct, this output is stored as the “approved” output. If not, fix the software and repeat until the output produced is correct.</li>
<li class="">On subsequent test runs, the tool will compare the output produced to the “approved” output previously recorded. If they are found to be the same, then the approval test has passed. If not, the approval test has failed.</li>
</ol>
<p><a href="https://llewellynfalco.blogspot.com/2008/10/approval-tests.html" target="_blank" rel="noopener noreferrer" class=""><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/4a86f8b2941c2df901285e13bfdc8145f8a014557b4dea710531585bb752a76c-41a8f813c82c7eca4e2a4d4808fa87f1.png" width="380" height="306" class="img_ev3q"></a></p>
<p><a href="https://llewellynfalco.blogspot.com/2008/10/approval-tests.html" target="_blank" rel="noopener noreferrer" class="">https://llewellynfalco.blogspot.com/2008/10/approval-tests.html</a></p>
<p>Naturally, it’s not quite as simple as that. For example, if the complex output that we’re comparing includes timestamps, these will likely be different each time the test is run. Therefore, approval testing tools typically include mechanisms to specify parts of the output that should not be compared. These exclusions will be specified when the approval test is first created and stored alongside the test.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="does-approval-testing-work-for-uis">Does approval testing work for UIs?<a href="https://cucumber.io/blog/bdd/bdd-approval-testing-and-visualtest#does-approval-testing-work-for-uis" class="hash-link" aria-label="Direct link to Does approval testing work for UIs?" title="Direct link to Does approval testing work for UIs?" translate="no">​</a></h2>
<p>Simply specifying areas of the output that should not be compared is insufficient if we’re trying to automatically verify the correctness of a visual component. Perhaps a text field is now too close to the border of a control or one visual element is overlaying/obscuring another one.</p>
<p>In these situations, machine learning (ML) and artificial intelligence (AI) can deliver huge benefits. Our tests can leverage these technologies to identify these hard-to-spot issues to a precision that the human eye cannot. But they take time – and slow feedback from a build is the enemy of automated testing.</p>
<p>Instead, AI/ML powered visual tests should be run in a separate stage in the build pipeline, after the faster automated checks have already passed. This ensures that developers get the fast feedback they require while also delivering confidence that the UI is free of visual defects.</p>
<p>If the visual tests pass, then all is well. If there’s a failure during the visual tests, then manual investigation is required – because not all failures indicate a defect in the code.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="when-is-a-failure-not-a-fail">When is a failure not a fail?<a href="https://cucumber.io/blog/bdd/bdd-approval-testing-and-visualtest#when-is-a-failure-not-a-fail" class="hash-link" aria-label="Direct link to When is a failure not a fail?" title="Direct link to When is a failure not a fail?" translate="no">​</a></h2>
<p>We normally think of a test as having a binary outcome. It either passes or fails. Life in software development is rarely that simple. To ensure that the software we ship satisfies our customers’ needs we want to minimize false positives. So, when a test passes, we need to be confident that the behavior being verified is implemented correctly.</p>
<p>When a test fails, it doesn’t necessarily mean that the behavior has been implemented incorrectly. In my experience there are three common situations that cause a test to fail:</p>
<ol>
<li class="">Incorrect implementation: this could be caused by a misunderstanding of the specification or an error in the implementation.</li>
<li class="">Incorrect specification: the test is performing the wrong check(s) or the check(s) are being carried out incorrectly.</li>
<li class="">BDD/TDD: the test has been written before the behavior it’s designed to check has been implemented.</li>
</ol>
<p>When any sort of failure happens in a build, investigation is required. If you find that Situation 1 or 2 has occurred, fix the defect (either in the implementation or the specification) and run the build again.</p>
<p>Situation 3) is a signal to the development team that the work is incomplete. Seeing an automated test fail is an important part of all BDD/TDD workflows. Usually, we would like the failure to be seen in the developers’ environment and made to pass before being pushed to CI. However, some workflows may see the tests committed and pushed before the behavior being verified is implemented.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="visualtest--an-aiml-powered-visual-approval-testing-tool">VisualTest – an AI/ML powered visual approval testing tool<a href="https://cucumber.io/blog/bdd/bdd-approval-testing-and-visualtest#visualtest--an-aiml-powered-visual-approval-testing-tool" class="hash-link" aria-label="Direct link to VisualTest – an AI/ML powered visual approval testing tool" title="Direct link to VisualTest – an AI/ML powered visual approval testing tool" translate="no">​</a></h2>
<p>There are several popular approval testing tools available (<a href="http://www.texttest.org/" target="_blank" rel="noopener noreferrer" class="">TextTest</a>, <a href="https://approvaltests.com/" target="_blank" rel="noopener noreferrer" class="">ApprovalTests</a>), but they lack the powerful AI/ML techniques that are needed for effective assurance of UIs and other graphical outputs. SmartBear provides a new tool that fills a gap that has long been overlooked in the full stack of UI testing - <a href="https://smartbear.com/product/visualtest/" target="_blank" rel="noopener noreferrer" class="">VisualTest</a>.</p>
<p><a href="https://smartbear.com/product/visualtest/" target="_blank" rel="noopener noreferrer" class=""><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/b31c86193621694c76fc958b10571a6e66db0279b93d6a193dd46641911540da-d5ca39ad9180b755c296d2b1cca22973.jpeg" width="1200" height="627" class="img_ev3q"></a></p>
<p><a href="https://smartbear.com/product/visualtest/" target="_blank" rel="noopener noreferrer" class="">https://smartbear.com/product/visualtest/</a></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://cucumber.io/blog/bdd/bdd-approval-testing-and-visualtest#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>The development team need regular, fast feedback to give them visibility of important aspects of their software’s quality. They need confidence that they’re developing the right thing in the right way.</p>
<p>BDD and TDD are techniques that give developers that confidence (among other benefits). Currently, most organisations that adopt these approaches use popular assertion-based tools to verify that the code being developed satisfies the specifications. This focus on assertion-based testing is unsuitable for some of the subtle and complex issues that occur when developing today’s applications.</p>
<p>Approval testing in all its flavours can help bridge the gap between automated assertion checking and time-consuming manual testing. Existing approval testing libraries are excellent when dealing with complicated textual outputs and simple graphical components. VisualTest leverages AI/ML to fill that gap and bring approval testing for modern UIs within reach of reliable automated testing.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[BDD with Event Mapping]]></title>
        <id>https://cucumber.io/blog/bdd/bdd-with-event-mapping</id>
        <link href="https://cucumber.io/blog/bdd/bdd-with-event-mapping"/>
        <updated>2022-12-12T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[The original version of this post was published on Medium by The BDD Advocate.]]></summary>
        <content type="html"><![CDATA[<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/jon-acker-event-mapping-hero-eee43ea70efee9167aca93057af01d9c.webp" width="854" height="270" class="img_ev3q"></p>
<p><em>The original version of this post was <a href="https://thebddadvocate.medium.com/bdd-with-event-mapping-c5a66a9e4b82" target="_blank" rel="noopener noreferrer" class="">published on Medium by The BDD Advocate</a>.</em></p>
<p>The full spectrum of Behaviour Driven Development involves collaborative activities at both a high level, e.g. discovery workshops, and at a lower level — in terms of automating the discovered use-cases.</p>
<p>The discovery however, is sometimes the hardest part, making sure all the use-cases of the system are known and understood by all concerned: from the product owners, who know how the product should work, to the programmers who need to build the system to these precise specifications.</p>
<p>There are several collaborative techniques for facilitating group activities that lead to a clearer understanding of the system, but knowing where to start is always challenging. I have found that, by collaboratively building a timeline, one is forced to gradually cover the whole scope of the system’s behaviour, and through which it becomes clear to everyone what  the essential and/or most complex features of the system are.</p>
<p>I’ve decided to call this particular technique “<strong>Event Mapping</strong>”, in reference to two popular methods of collaboratively understanding software requirements. In both of these approaches, technical people should work alongside product people, with the aim of communicating as clearly as possible and developing a shared understanding.</p>
<p>The first is <strong>Event Storming</strong>, a highly collaborative technique for sketching out the timeline of a system (for either existing or future requirements) in terms of system-commands and system-events (which makes this technique very well suited to event-driven systems). Event Storming, a term coined by Alberto Brandolini, requires participants to write down system events that are of interest to the business on post-it notes and place them on a long sheet of paper that represents a timeline. This activity eventually delineates the system in terms of significant events that happen throughout its lifetime (e.g. “Order Was Dispatched”) and the commands which cause them (e.g. “Place Order for Items”).</p>
<p>In this way, the whole group effectively visualises what happens when and why. In this way it becomes easy to see and discuss both the logic and the order in which things are supposed to happen.</p>
<p><strong>Example Mapping</strong>, another collaborative technique invented by Matt Wynne, focuses on deriving use-cases or scenarios from business rules. The output of an <strong>Example Mapping</strong> session is a set of clear-cut examples of how of a user would use the required system; the examples must be concrete enough to be translated into executable specifications (e.g. gherkin). For example, each “feature”, or “capability” of the system is focused on in turn. The business rules are clearly spelt out (for example “members are fined £5 if a book is returned late”) and these examples are teased-out collectively by the product owner and the team.</p>
<p>Each example is written down on sticky note and placed below the rule they illustrate. The examples should be as concrete as necessary to remove ambiguity from the rule that they are illustrating. Imagine we had a rule that says books can only be taken out for 2 days, otherwise a fine is issued. A relevant example used to illustrate this rule might be: “Jon attempts to return a book he took out 3 days ago”</p>
<p>From these, gherkin scenarios can then be easily written down or scenarios picked as candidates for automation.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="a-gherkin-scenario-is-basically-a-micro-timeline">A Gherkin scenario is basically a micro-timeline<a href="https://cucumber.io/blog/bdd/bdd-with-event-mapping#a-gherkin-scenario-is-basically-a-micro-timeline" class="hash-link" aria-label="Direct link to A Gherkin scenario is basically a micro-timeline" title="Direct link to A Gherkin scenario is basically a micro-timeline" translate="no">​</a></h2>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/jon-acker-event-mapping-1-e4d5a3085936cdc0900dfb50c1e51d89.webp" width="935" height="610" class="img_ev3q"></p>
<p>To recap: Using the Gherkin format of Given/When/Then for describing system use-cases is simply a way of making the three stages of a test explicit. <em>Every</em> test for a dynamic system has three phases:</p>
<ol>
<li class="">Set-up the system in a known state, which it needs to be in for the use-case to be tested — i.e what needs to have happened before (2)</li>
<li class="">Take the action to test / Carry out the use-case on the system</li>
<li class="">Check that the expected outcome happened — as a result of playing out the use-case.</li>
</ol>
<p>As a colleague of mine pointed out, after he’d taken part in a few Event Storming workshops: When you’ve got all the events and commands lined up in temporal order — it becomes trivial to write Given/When/Then scenarios.</p>
<p>The reason for this is of course that the sequence Event-Command-Event maps directly to Given/When/Then. Indeed, when modelling an event-driven system, things become even simpler: The implementation of the <strong><em>Given</em></strong> step are the relevant events that happen directly before the command we want to test. The <strong><em>When</em></strong> step is simply the command we give the system, and the <strong><em>Then</em></strong> step checks that the expected events were emitted as a result of executing the command. <em>Considered in this way, <strong>scenarios are essentially micro-timelines</strong>.</em></p>
<p>In order to extract use-cases, we only need to look for the commands — plus the events that directly precede and follow it. The process for this is no different for an event-driven system than it is for a synchronous API based system.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="example-use-case-library-lending-system">Example use case: Library Lending System<a href="https://cucumber.io/blog/bdd/bdd-with-event-mapping#example-use-case-library-lending-system" class="hash-link" aria-label="Direct link to Example use case: Library Lending System" title="Direct link to Example use case: Library Lending System" translate="no">​</a></h2>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/jon-acker-event-mapping-2-3058c686d119b85713cae8af659ee0e0.webp" width="814" height="321" class="img_ev3q"></p>
<p>The “business rules” are simply the rules by which the business operates. For each rule, we need to come up with an example (how the rule is used). They can be written down at the same time as coming up with the events in the timeline. Depending on the rule, an alternate timeline might split off from the main one.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="event-mapping">Event Mapping<a href="https://cucumber.io/blog/bdd/bdd-with-event-mapping#event-mapping" class="hash-link" aria-label="Direct link to Event Mapping" title="Direct link to Event Mapping" translate="no">​</a></h2>
<p>By sketching the events that happen in the system on to a downward-facing timeline, we can build up a mapping from events and commands directly to Gherkin scenarios. I’d encourage not thinking about the distinction between events and commands but rather just sketch-out “significant things” that happen over time. It will become quickly clear which are events and which are commands. The latter are, in-effect, how the user interacts with the system. For example, if the user is a library member, a command they might issue to the system would be “Return Book X”</p>
<p>It is helpful to then use the two colours traditionally assigned to events and commands in order to separate them visually (orange and blue, respectively). This assists greatly in identifying scenarios and extracting them into a Given/When/Then formulation. I’ve used Miro boards, which is a great tool for remote collaboration, and it’s nice for anchoring the event/command/event arrows to given/when/then (they “stick” together when moved around).</p>
<p>As with example mapping, the resulting scenarios each illustrate one of the rules shown above: For example, we might have</p>
<ul>
<li class="">An orange <strong>event</strong> sticky saying “Jon borrowed the book on the 21st Oct” (this could be event is dispatched on the 21st Oct.)</li>
<li class="">A blue <strong>command</strong> sticky saying “Jon returns the book on the 28th of Oct” (the command is sent to the system on this date)</li>
<li class="">A second orange <strong>event</strong> stick follows it saying “Jon is issued a £10 fine” (date here is irrelevant to this scenario)</li>
</ul>
<p>This triad would together form the scenario: <strong>Returning a book late results in a £10 fine</strong></p>
<p><strong><em>Given:</em></strong> <em>“Jon” borrowed the book at 12pm on the 21st Oct</em><br>
<strong>When</strong> <em>“Jon” returns the book at 12pm on the 28th of Oct</em><br>
<strong>Then</strong> <em>“Jon” should be issued a £10 fine</em></p>
<p>The scenarios are then excellent candidates for automation using tools such as Cucumber or Behat.</p>
<p>Alternately, we could consider automating the actual timeline — rather than use Gherkin. Given the Advanced API Miro-Boards provide, this is technically feasible. (Worth noting here that executable specifications don’t have to be written in Gherkin. The behavioural expectations of the system don’t have to be expressed in words, they can also be expressed in graphs or even pictorial examples — see Approval Testing tools)</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/jon-acker-event-mapping-3-55f04f5cf7bf7d63912519aee8f544c5.webp" width="1247" height="473" class="img_ev3q"></p>
<p>As the number of scenarios grows, the ubiquitous language of the domain (see DDD) will gradually come into sharper focus. Which book was loaned? At what time? So you say that a member “<em>reserves a book</em>” but that the Library “<em>puts a book on hold”</em>?</p>
<p>As scenarios of a temporal nature are added, such as “What happens when a book is returned late?”, the times are added to the scenarios. It’s very useful, in such cases, to have a timeline right next to the scenarios themselves.<br>
The timeline should be detailed enough to contain the precise times of borrowing and returning, and the scenarios should merely have to copy details of those specific interactions.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/jon-acker-event-mapping-4-1f04fd925382a9c07ec2771cf5fbf26b.webp" width="1141" height="385" class="img_ev3q"></p>
<p>For alternate timelines (Jane returns the book late) I draw a parallel timeline which splits off from the main timeline. Events that happen on this timeline effectively become separate scenarios (e.g. the one where Jane is fined).</p>
<p>Finally, we can use different ways to mark or identify different scenarios. Here’s a screenshot from a session I ran at the last <a class="" href="https://cucumber.io/community">Cukenfest</a>. I later identified the use-cases that can be mapped to scenarios and marked them using different coloured rectangles.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/jon-acker-event-mapping-5-389fa4396aaa6d575b58099ce107eba6.webp" width="1454" height="842" class="img_ev3q"></p>]]></content>
        <author>
            <name>Jon Acker</name>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Bringing feature context to your testing best practices]]></title>
        <id>https://cucumber.io/blog/product/bringing-feature-context-to-your-testing</id>
        <link href="https://cucumber.io/blog/product/bringing-feature-context-to-your-testing"/>
        <updated>2022-02-07T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[At Split, we believe the primary unit of work for software teams is the feature.]]></summary>
        <content type="html"><![CDATA[<p>At <a href="https://www.split.io/" target="_blank" rel="noopener noreferrer" class="">Split</a>, we believe the primary unit of work for software teams is the feature.</p>
<p><a href="https://www.split.io/glossary/feature-flags/" target="_blank" rel="noopener noreferrer" class="">Feature flags</a> are transforming the way we develop software. These sections of code govern the execution of a specific software feature, allowing that feature to be toggled on and off without a new deployment. Every tool we use to develop, test, and measure product changes must adapt.</p>
<p>Because of recent advances, feature flags allow releases to be more stable than ever. More teams are testing in production, as they are now able to roll back feature changes with the flip of a switch. Even with these advances, however, we still need to deploy best practices when testing our production changes, to protect users from a poor experience.</p>
<p>We need to bring testing to the forefront. By testing the multiple states of a feature flag directly, we can ensure the application will function properly as flags are toggled. In 2017, we <a href="https://www.split.io/blog/feature-flags-java-testing/" target="_blank" rel="noopener noreferrer" class="">announced an enhancement</a> to our Java client which allows you to programmatically change the treatments returned by the Split client. As a result, you can start a test by setting the specific feature flag and treatments you wish to test.</p>
<p>Today, we’re partnering with SmartBear to enhance those capabilities to work directly with Cucumber.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="how-it-works">How it works<a href="https://cucumber.io/blog/product/bringing-feature-context-to-your-testing#how-it-works" class="hash-link" aria-label="Direct link to How it works" title="Direct link to How it works" translate="no">​</a></h3>
<p>Our focus is to let teams toggle flags as part of their automated acceptance testing process. With <a href="https://github.com/cucumber/split-java" target="_blank" rel="noopener noreferrer" class="">Cucumber-Split</a>, you can toggle feature flags declaratively with tags, then verify the software works as expected.</p>
<p>Imagine we're building firmware for a coffee machine, and can deploy the new firmware over the internet with continuous deployment. The coffee machine is currently able to serve espresso and caffè lattes. The team is working on an experimental new feature to serve flat whites as well, available only to a small set of customers.</p>
<p>We introduce a feature flag to control whether flat whites are available. Only a few customers will have flat white functionality, but we want to test to make sure it works as expected.</p>
<p>Two scenarios verify options in the drink selection menu: one where flat white is not available (the feature flag is off), and another where it is (the feature flag is on).</p>
<div class="language-gherkin codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#0f172a;--prism-background-color:var(--ifm-hero-background-color)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-gherkin codeBlock_bY9V thin-scrollbar" style="color:#0f172a;background-color:var(--ifm-hero-background-color)"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#0f172a"><span class="token feature keyword" style="color:#0c4a6e">Feature:</span><span class="token feature important"> Make Coffee</span><span class="token feature"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token feature"></span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><span class="token tag" style="color:#0ea5e9">@split[flat-white:off]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><span class="token scenario keyword" style="color:#0c4a6e">Scenario:</span><span class="token scenario important"> Display available drinks</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Given</span><span class="token plain"> the machine is not empty</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Then</span><span class="token plain"> the following drinks should be available:</span><span class="token table-head"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-head">      </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> name          </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> price </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> espresso      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b">  1.90 </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> caffe latte   </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b">  2.30 </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><span class="token tag" style="color:#0ea5e9">@split[flat-white:on]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><span class="token scenario keyword" style="color:#0c4a6e">Scenario:</span><span class="token scenario important"> Display available drinks (including the new experimental flat white)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Given</span><span class="token plain"> the machine is not empty</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Then</span><span class="token plain"> the following drinks should be available:</span><span class="token table-head"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-head">      </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> name          </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> price </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> espresso      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b">  1.90 </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> flat white    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b">  2.10 </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> caffe latte   </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b">  2.30 </span><span class="token table-body punctuation" style="color:#475569">|</span><br></span></code></pre></div></div>
<p>When we run these two scenarios with Cucumber, we gain confidence that the flat white feature flag works as expected, both when it’s on and when it’s off.</p>
<p>To learn more, and read a step-by-step installation guide, follow the detailed instructions in the <a href="https://github.com/cucumber/split-java" target="_blank" rel="noopener noreferrer" class="">Cucumber-Split GitHub repo</a>.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="beyond-testing-solutions-the-tools-we-use-need-to-continue-to-evolve-to-be-feature-aware">Beyond testing solutions, the tools we use need to continue to evolve to be feature aware<a href="https://cucumber.io/blog/product/bringing-feature-context-to-your-testing#beyond-testing-solutions-the-tools-we-use-need-to-continue-to-evolve-to-be-feature-aware" class="hash-link" aria-label="Direct link to Beyond testing solutions, the tools we use need to continue to evolve to be feature aware" title="Direct link to Beyond testing solutions, the tools we use need to continue to evolve to be feature aware" translate="no">​</a></h3>
<p>New, more nuanced solutions allow us to keep work moving with high quality.</p>
<ul>
<li class="">Work management solutions: Need to associate work to be done to the feature flag gating the work.</li>
<li class="">Deployment solutions: Need to automate the configuration of feature flags as part of your deployment process.</li>
<li class="">Application-monitoring solutions: Need to see feature flag context to better understand transaction level data to answer the simple question: “Do users seeing the new feature have higher page load times?”</li>
<li class="">Error-monitoring solutions: Need to see feature flag context to better understand error data to answer the simple question: “Do users seeing the new feature have an increased number of errors?”</li>
<li class="">Product-analytics solutions: Require feature flag context to understand the impact of new features on the product experience and the business. “Do users seeing the new feature engage at higher rates?”</li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="looking-forward">Looking forward<a href="https://cucumber.io/blog/product/bringing-feature-context-to-your-testing#looking-forward" class="hash-link" aria-label="Direct link to Looking forward" title="Direct link to Looking forward" translate="no">​</a></h3>
<p>As feature flags increase in adoption, our tools need to adapt and accommodate our evolving development practices.</p>
<p>The <a href="https://www.split.io/product/feature-delivery-lifecycle/" target="_blank" rel="noopener noreferrer" class="">feature delivery lifecycle</a> is like a flywheel for being intentional, moving fast in a safe way, and being keenly aware of the impact your work has on end users. Trunk-based development and the demands of the mobile-app ecosystem mean teams rely on feature flags to maintain speed, safety, and agility.</p>
<p>Make sure you stay feature flag aware.</p>]]></content>
        <author>
            <name>Trevor Stuart</name>
        </author>
    </entry>
    <entry>
        <title type="html"><![CDATA[Webinar: Introduction to Formulation]]></title>
        <id>https://cucumber.io/blog/bdd/introduction-to-formulation</id>
        <link href="https://cucumber.io/blog/bdd/introduction-to-formulation"/>
        <updated>2021-09-22T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[A couple of weeks ago, Gáspár Nagy and I presented a webinar on the BDD practice of formulation. There were so many questions that we were unable to answer them all in the allotted time, so we’re taking this opportunity to publish our answers as a blog.]]></summary>
        <content type="html"><![CDATA[<p>A couple of weeks ago, Gáspár Nagy and I <a href="https://smartbear.com/resources/webinars/intro-to-formulation-documenting-bdd-scenarios/" target="_blank" rel="noopener noreferrer" class="">presented a webinar</a> on the BDD practice of formulation. There were so many questions that we were unable to answer them all in the allotted time, so we’re taking this opportunity to publish our answers as a blog.</p>
<p>We’ve merged similar questions together, so what you see below is a summary of the outstanding questions.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="where-can-i-learn-more">Where can I learn more?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#where-can-i-learn-more" class="hash-link" aria-label="Direct link to Where can I learn more?" title="Direct link to Where can I learn more?" translate="no">​</a></h2>
<p>We have published two BDD books (Discovery &amp; Formulation) that are available from Leanpub (multiple ebook formats) and Amazon (print &amp; Kindle). Visit <a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">http://bddbooks.com</a> for full details.</p>
<p>I have previously blogged an excerpt from the Formulation book, describing the BRIEF acronym. <a class="" href="https://cucumber.io/blog/bdd/keep-your-scenarios-brief/">https://cucumber.io/blog/bdd/keep-your-scenarios-brief/</a></p>
<p>The Cucumber open source community maintains documentation online. A good place to start is <a class="" href="https://cucumber.io/docs/bdd">https://cucumber.io/docs/bdd</a></p>
<p>SmartBear provides free training videos that focus on using Cucumber (and Specflow) for C#, Java, JavaScript, and Ruby developers. <a href="https://school.cucumber.io/" target="_blank" rel="noopener noreferrer" class="">https://school.cucumber.io</a></p>
<p>If you want to play around with Cucumber or Specflow, but don’t want to install the software on your machine, then head over to <a href="https://www.cyber-dojo.org/creator/home" target="_blank" rel="noopener noreferrer" class="">Cyber-Dojo</a>, where you can experiment with whichever version of Cucumber that interests.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="i-have-a-question-about-the-scenario-you-presented">I have a question about the scenario you presented…<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#i-have-a-question-about-the-scenario-you-presented" class="hash-link" aria-label="Direct link to I have a question about the scenario you presented…" title="Direct link to I have a question about the scenario you presented…" translate="no">​</a></h2>
<p>In the webinar we formulated a scenario from sample software system being developed for a public library. You can <a href="https://smartbear.com/resources/webinars/intro-to-formulation-documenting-bdd-scenarios" target="_blank" rel="noopener noreferrer" class="">watch the webinar online</a>, but here’s the final scenario for reference:</p>
<div class="language-gherkin codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#0f172a;--prism-background-color:var(--ifm-hero-background-color)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-gherkin codeBlock_bY9V thin-scrollbar" style="color:#0f172a;background-color:var(--ifm-hero-background-color)"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#0f172a"><span class="token feature keyword" style="color:#0c4a6e">Feature:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  Rule: Members pay reservation $1 per item</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token scenario keyword" style="color:#0c4a6e">Scenario:</span><span class="token scenario important"> Library member reserves a book</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">      </span><span class="token atrule">Given</span><span class="token plain"> Andrew is a library member</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">      </span><span class="token atrule">When</span><span class="token plain"> he reserves one book</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">      </span><span class="token atrule">Given</span><span class="token plain"> he should be charged $1</span><br></span></code></pre></div></div>
<p>There were a couple of questions specifically about the structure of this scenario.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="are-given-when-and-then-the-only-keywords-that-introduce-steps-in-a-scenario">“Are Given, When and Then the only keywords that introduce steps in a scenario?”<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#are-given-when-and-then-the-only-keywords-that-introduce-steps-in-a-scenario" class="hash-link" aria-label="Direct link to “Are Given, When and Then the only keywords that introduce steps in a scenario?”" title="Direct link to “Are Given, When and Then the only keywords that introduce steps in a scenario?”" translate="no">​</a></h2>
<ul>
<li class=""><strong>Given</strong>  is used to set the context of a scenario</li>
<li class=""><strong>When</strong> is used to describe the action that should cause the behaviour being illustrated to take place</li>
<li class=""><strong>Then</strong>  is used to describe the expected outcome.</li>
</ul>
<p>Gherkin provides two other keywords that can be used to introduce steps: <strong>And</strong> and <strong>But.</strong> If you use one of these conjunctions, the implication is that the step is in the scope of the preceding <strong>Given</strong> / <strong>When</strong> / <strong>Then</strong>. So, if a <strong>Given</strong> is followed by an <strong>And</strong>, it means that the <strong>And</strong> step is intended to contribute to the context of the scenario.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="can-we-pass-the-total-quantity-to-be-reserved">“Can we pass the total quantity to be reserved?”<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#can-we-pass-the-total-quantity-to-be-reserved" class="hash-link" aria-label="Direct link to “Can we pass the total quantity to be reserved?”" title="Direct link to “Can we pass the total quantity to be reserved?”" translate="no">​</a></h2>
<p>Passing parameters is specifically an automation question, and the answer is “YES!”. You can find more details on parameter passing in the <a class="" href="https://cucumber.io/docs/cucumber/cucumber-expressions/">Cucumber Expression documentation</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="why-doesnt-your-scenario-contain-more-detail">Why doesn’t your scenario contain more detail?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#why-doesnt-your-scenario-contain-more-detail" class="hash-link" aria-label="Direct link to Why doesn’t your scenario contain more detail?" title="Direct link to Why doesn’t your scenario contain more detail?" translate="no">​</a></h2>
<p>The ‘E’ in our BRIEF acronym stands for <strong><em>essential</em></strong>. Every piece of information in a scenario should be essential to understanding the system’s behaviour with respect to the Rule being illustrated and the Scenario being described. The running system will require plenty of other details to actually run, but the scenario should contain only information that is essential to understanding the specific behaviour being illustrated.</p>
<p>Details that aren’t essential for one scenario will be essential for others. It’s hard to see when we’re only looking at a single scenario in isolation, but becomes clearer if you imagine what a complete set of scenarios will look like.</p>
<p>That still leaves the question of how you can illustrate a behaviour in the middle of a customer journey without including <strong>Given</strong> steps that cover all the actions that a user would have to go through to get the system into the necessary state. The answer is to find a way of describing the journey to that state in a single <strong><em>intention revealing</em></strong> way.This is what the statement, the statement “<strong>Given</strong> Andrew is a library member” does in the sample scenario. It could be expanded with all the steps that Andrew had to go through to join the library, but that would be confusing. Instead, we’ve found a way that describes the intent of all those inessential steps that we’ve omitted.</p>
<p>An additional benefit of this approach to omitting incidental detail is that it gives our developers freedom to choose how to automate the scenario. They could automate this step by manipulating the system’s UI and going through the full sign up process. Or they could search the member database to find a suitable user to use in the scenario. Or the automation could directly insert a new library member into the database at the beginning of the scenario and delete it at the end. The choice is not important from a behavioural viewpoint – all of them would illustrate that reserving a book will cost Andrew $1.00 – but it does mean that we can build an automation suite that conforms to the <a class="" href="https://cucumber.io/blog/bdd/eviscerating-the-test-automation-pyramid/">test automation pyramid</a>, robustly giving us fast feedback and confidence in our application.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="shouldnt-scenarios-cover-a-full-user-journey">Shouldn’t scenarios cover a full user journey?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#shouldnt-scenarios-cover-a-full-user-journey" class="hash-link" aria-label="Direct link to Shouldn’t scenarios cover a full user journey?" title="Direct link to Shouldn’t scenarios cover a full user journey?" translate="no">​</a></h2>
<p>The scenarios that we.ve been looking at so far focus on illustrating a single behaviour. This is what we call an <strong><em>illustrative</em></strong> scenario. There’s also a need for scenarios that cover complete user interactions, which are called <strong><em>journey</em></strong> scenarios. We didn’t speak about these in the webinar, but they are covered in our <a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">Formulation book</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="how-can-i-use-gherkin-to-describe-asynchronous-behaviours">How can I use Gherkin to describe asynchronous behaviours?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#how-can-i-use-gherkin-to-describe-asynchronous-behaviours" class="hash-link" aria-label="Direct link to How can I use Gherkin to describe asynchronous behaviours?" title="Direct link to How can I use Gherkin to describe asynchronous behaviours?" translate="no">​</a></h2>
<p>Asynchrony is always hard to reason about. Nonetheless, Gherkin scenarios that follow the BRIEF principles are perfectly suitable for illustrating single aspects of asynchronous behaviours. There’s no need to always document each step of the interactions in every scenario. As described in the previous answer, try to describe the context using a single, <strong><em>intention revealing</em></strong> statement.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="shouldnt-steps-be-atomic">Shouldn’t steps be <em>atomic</em>?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#shouldnt-steps-be-atomic" class="hash-link" aria-label="Direct link to shouldnt-steps-be-atomic" title="Direct link to shouldnt-steps-be-atomic" translate="no">​</a></h2>
<p>It’s really important that each scenario should be isolated from every other scenario. This means that scenarios should be able to run in any order and still get the same result. All flavours of Cucumber go to great lengths to help enforce this, but automation engineers need to be aware of this necessity, because there are numerous ways that they can inadvertently break this important rule.</p>
<p>On the other hand, it’s frequently necessary for data to flow between steps within a scenario. Again, all flavours Cucumber provide mechanisms to facilitate this sharing of information – although these mechanisms vary between programming languages. You can find more details in the <a class="" href="https://cucumber.io/docs/cucumber/step-definitions/#state-management">open source documentation</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="is-this-a-good-scenario">Is this a “good” scenario?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#is-this-a-good-scenario" class="hash-link" aria-label="Direct link to Is this a “good” scenario?" title="Direct link to Is this a “good” scenario?" translate="no">​</a></h2>
<p><strong>Given</strong> the url is input in the browser<br>
<strong>When</strong> the user presses “enter”<br>
<strong>Then</strong> the Login page opens</p>
<p>Without knowing what rule this scenario is supposed to illustrate, it’s hard to be certain whether it has been written in an appropriate way. On first inspection however, I suspect that it goes against the recommendation for scenarios to be <strong><em>intention revealing</em></strong>. The scenario as written seems to be very mechanical, talking about browsers, keypresses (“enter”), and pages.</p>
<p>What is the user trying to do? What behaviour are we trying to illustrate?</p>
<p>Even if you can convince yourself that this isn’t a problem, this scenario doesn’t include appropriate <strong><em>real data</em></strong>. What URL is the user navigating to?</p>
<p>So, its more than likely that this will not be a useful scenario that helps to define valuable behaviour from a business perspective.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="isnt-bdd-just-an-expensive-way-of-writing-automated-tests">Isn’t BDD just an expensive way of writing automated tests?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#isnt-bdd-just-an-expensive-way-of-writing-automated-tests" class="hash-link" aria-label="Direct link to Isn’t BDD just an expensive way of writing automated tests?" title="Direct link to Isn’t BDD just an expensive way of writing automated tests?" translate="no">​</a></h2>
<p>As we mentioned during the webinar, we believe that there is little value to be gained from using Cucumber (and Gherkin) to write automated test scripts. You can use them in this way, but the resulting scripts are often brittle, deliver little documentation value to the team as a whole, and thus are costly to maintain.</p>
<p>BDD is a collaborative approach to developing software that leverages the different perspectives of team members to fully understand the requirements underpinning a story before any code or tests are written. This shared understanding is captured using <strong><em>business readable</em></strong> terminology that will then act as an unambiguous specification of the system’s expected behaviour.</p>
<p>Additionally, once automated, a failing scenario will guide the developers to write just enough code to get the scenario to pass (and by inference, exactly the behaviour that was specified). Once passing, the scenarios are described as <strong><em>living documentation</em></strong>, which can be relied upon to be correct, because they are validated against the actual system every time it is built.</p>
<p>It is within the context of these multiple benefits that the additional investment of writing Gherkin scenarios contributes a significant return on investment (ROI). If you’re simply using Cucumber/Gherkin to turn a manual test script into an automated test script, then your ROI will be minimal.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="im-already-busy-how-can-i-fit-bdd-in-on-top-of-everything-else">I’m already busy. How can I fit BDD in on top of everything else?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#im-already-busy-how-can-i-fit-bdd-in-on-top-of-everything-else" class="hash-link" aria-label="Direct link to I’m already busy. How can I fit BDD in on top of everything else?" title="Direct link to I’m already busy. How can I fit BDD in on top of everything else?" translate="no">​</a></h2>
<p>Adopting BDD requires up front investment for long term savings. Stories should be refined (using example mapping) before they are pulled into a sprint. That’s because, before you have a detailed, shared understanding of what the story <strong>really</strong> entails, it’s impossible to know how large it actually is.</p>
<p>Using the automated scenarios to guide the development means that developers know exactly what they need to deliver, so unnecessary rework is minimised. The growing suite of automated scenarios act become a valuable regression suite, allowing faster releases and reduced customer defects. The trustworthy <em>living documentation</em> that this produces means that, when the team is asked to modify or enhance the product, they don’t need to waste time reverse engineering the system’s capabilities.</p>
<p>Adopting BDD takes time, planning, and organisational support. It requires a change of working practices to succeed. But the payoff is massive – in development costs, software quality, employee morale, and customer satisfaction.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="can-bdd-be-used-for-apis">Can BDD be used for APIs?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#can-bdd-be-used-for-apis" class="hash-link" aria-label="Direct link to Can BDD be used for APIs?" title="Direct link to Can BDD be used for APIs?" translate="no">​</a></h2>
<p>In a word, “Yes”. There are different considerations to API design and documentation – the customer is much more likely to be another developer rather than a business person – but the principles of discovery, formulation, and automation still apply.</p>
<p>You can see an example of API design and implementation using BDD, Cucumber, and SwaggerHub in this conference session from  Connect 2020.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="can-i-use-selenium-when-developing-using-a-bdd-approach">Can I use Selenium when developing using a BDD approach?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#can-i-use-selenium-when-developing-using-a-bdd-approach" class="hash-link" aria-label="Direct link to Can I use Selenium when developing using a BDD approach?" title="Direct link to Can I use Selenium when developing using a BDD approach?" translate="no">​</a></h2>
<p>BDD and Cucumber don’t force you to use specific automation tools or libraries, so you can certainly use Selnium. However, remember the advice of the <a class="" href="https://cucumber.io/blog/bdd/eviscerating-the-test-automation-pyramid/">test automation pyramid</a>. To paraphrase – build your test strategy on a foundation of small, fast, reliable automated tests. Using Selenium tends to produce end to end tests, at the top of the pyramid – and we want as few of these as we can get away with, because they are typically big, slow, and flaky.</p>
<p>Just because we write the scenarios using <strong><em>business readable</em></strong> language doesn’t mean that the automation can’t be implemented lower down the pyramid. I <a href="http://claysnow.co.uk/the-testing-iceberg/" target="_blank" rel="noopener noreferrer" class="">blogged about this</a> some time ago.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="should-i-use-cucumber-or-testng">Should I use Cucumber or TestNG?<a href="https://cucumber.io/blog/bdd/introduction-to-formulation#should-i-use-cucumber-or-testng" class="hash-link" aria-label="Direct link to Should I use Cucumber or TestNG?" title="Direct link to Should I use Cucumber or TestNG?" translate="no">​</a></h2>
<p>If you’re wanting to write automated tests, then a testing tool is what you need. In that case TestNG (or similar) is exactly what you need.</p>
<p>If you want to adopt BDD as a way of increasing collaboration, increasing quality, and reducing misunderstandings, then you need a collaboration tool that enables your business colleagues to participate directly. This is the use case that Cucumber and Gherkin have been designed for. Teams have used Cucumber simply as a test tool, but we do not recommend this, because we see little return on investment from using in this way.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Tackling structural racism and sexism in open source]]></title>
        <id>https://cucumber.io/blog/open-source/tackling-structural-racism-and-sexism-in-open-so</id>
        <link href="https://cucumber.io/blog/open-source/tackling-structural-racism-and-sexism-in-open-so"/>
        <updated>2021-08-05T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[One of the goals the Cucumber team have set ourselves this year is to increase the number of recent, regular contributors who are non-white or non-male from 0 to 2. This post describes why we want to do this, what we’ve learned so far about the systemic barriers that keep the community of people who contribute to open source so utterly imbalanced, and outlines how we’ve started tackling the problem in our own project.]]></summary>
        <content type="html"><![CDATA[<p>One of the goals the Cucumber team have set ourselves this year is to increase the number of recent, regular contributors who are non-white or non-male from 0 to 2. This post describes <strong>why</strong> we want to do this, <strong>what</strong> we’ve learned so far about the systemic barriers that keep the community of people who contribute to open source so <a href="https://www.wired.com/2017/06/diversity-open-source-even-worse-tech-overall/" target="_blank" rel="noopener noreferrer" class="">utterly imbalanced</a>, and outlines <strong>how</strong> we’ve started tackling the problem in our own project.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="why-does-this-matter">Why does this matter?<a href="https://cucumber.io/blog/open-source/tackling-structural-racism-and-sexism-in-open-so#why-does-this-matter" class="hash-link" aria-label="Direct link to Why does this matter?" title="Direct link to Why does this matter?" translate="no">​</a></h2>
<p>In 2017, <a href="https://opensourcesurvey.org/2017/#insights" target="_blank" rel="noopener noreferrer" class="">GitHub ran a survey of 5,500 of its users</a>. The data shows that people of colour and women are disproportionately not contributing to open source:</p>
<p><em>Only <strong>three percent</strong> identified as female and one percent as non-binary. According to <a href="https://www.bls.gov/cps/cpsaat11.htm" target="_blank" rel="noopener noreferrer" class="">Bureau of Labor Statistics</a>, about <strong>22.6 percent</strong> of professional computer programmers are female.</em></p>
<p><em>About 16 percent of respondents said they belonged to ethnic or national groups that are in the minority in the country they live in. Black, Asian, and Latino programmers account for a total of about 34 percent of programmers in the US, according to the bureau.</em></p>
<p><em>(Source: <a href="https://www.wired.com/2017/06/diversity-open-source-even-worse-tech-overall/" target="_blank" rel="noopener noreferrer" class="">Wired.com</a>)</em></p>
<p><img decoding="async" loading="lazy" alt="charts showing gender and racial balance in tech and open source" src="https://cucumber.io/assets/images/8a3972687dc096f53626f6293f64a7480b6b6751dab00d0911bd7c9b76159be5-7c5838ea263b527c6d484b4775d2cea6.png" width="1846" height="594" class="img_ev3q"></p>
<p>That’s a massive number of people who are missing from our open-source communities.</p>
<p>In purely objective terms, this presents a huge opportunity for open source projects that are willing to put in the work to make their projects more welcoming. There’s an untapped pool of talent here, and projects that seek and respond to feedback from under-represented minorities will benefit from having more people making more contributions.</p>
<p>I also think there’s a moral argument. <a href="https://www.theguardian.com/world/2017/may/30/why-im-no-longer-talking-to-white-people-about-race" target="_blank" rel="noopener noreferrer" class="">Reni Eddo-Lodge describes structural racism</a> as:</p>
<p><em>Structural racism is dozens, or hundreds, or thousands of people with the same biases joining together to make up one organisation, and acting accordingly. Structural racism is an impenetrably white workplace culture set by those people, where anyone who falls outside the culture must conform or face failure. “Structural” is often the only way to describe what goes unnoticed – the silently raised eyebrows, the implicit biases, snap judgments made on assumptions of competency.</em></p>
<p>On that basis, it’s fair to say that open-source software has a problem with structural racism and, if you swap “white” for “male” in that quote, <a href="https://peerj.com/preprints/1733/?td=sd" target="_blank" rel="noopener noreferrer" class="">structural sexism</a> too. The reason we have so few women and people of colour in open source is because of things that we white men are doing, deliberately or not, that makes this an unwelcoming environment for those people.</p>
<p>Structural racism isn’t the responsibility of people of colour to fix. As the people who have enjoyed the privilege of being white and male all our lives, we’re the ones with the power to change the structure. It’s up to us to make it work for everyone, not just ourselves.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="open-source-is-intimidating">Open Source is intimidating<a href="https://cucumber.io/blog/open-source/tackling-structural-racism-and-sexism-in-open-so#open-source-is-intimidating" class="hash-link" aria-label="Direct link to Open Source is intimidating" title="Direct link to Open Source is intimidating" translate="no">​</a></h2>
<p>After this <a href="https://twitter.com/mattwynne/status/1401937810420953090" target="_blank" rel="noopener noreferrer" class="">initial tweet</a>, I embarked on a listening exercise, going to diversity meetups and having virtual coffees with people to hear about their experiences contributing to open source, about what had put them off. I took some notes in <a href="https://t.co/WODCeiVhPO?amp=1" target="_blank" rel="noopener noreferrer" class="">this Miro board</a>.</p>
<p>A common theme was the feeling of intimidation. The research showing that <a href="https://peerj.com/articles/cs-111/" target="_blank" rel="noopener noreferrer" class="">women's contributions are more likely to be scrutinised than men's</a>. The knowledge from experience that the expectations for minorities are higher. The risk that my livelihood might even be in jeopardy if I am criticized in public.</p>
<p>I learned about gatekeeping, the way that even well-meaning white folks will instinctively make all kinds of passive-aggressive moves to keep people who aren't like them out of their spaces, so they don't have to feel uncomfortable.</p>
<p>Then there is the feeling like an imposter, that everyone else is so much more experienced that you, so competent. I remember this feeling too from when I took my baby steps in open source many years ago. I can only imagine how much this is amplified by being from a less privileged background, with years of bitter experience <a href="https://www.olopua.com/?q=content/racism" target="_blank" rel="noopener noreferrer" class="">dealing with microagressions</a>. Finding the right community where you fit in and will be welcomed is super important.</p>
<p>There's not knowing where to start: Cloning an open-source codebase and wandering around it can be like turning up in a new city. Hopefully there are at least some signposts, but you're going to be lucky to find a decent map, let alone a tour guide.</p>
<p>Very often (and I know this has been the case for Cucumber) so called "<a href="https://kentcdodds.com/blog/first-timers-only" target="_blank" rel="noopener noreferrer" class="">good first issues</a>" are anything but "good". They still require a lot of context to be able to figure out and hack on. Even if the maintainers would be happy to answer questions if people asked, that might not be obvious.</p>
<p>The value of time also came up. A kid in college whose parents are wealthy can afford to spend their evenings contributing to open source for free. Someone less privileged might be busy flipping burgers to cover their tuition fees.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-impasse">The impasse<a href="https://cucumber.io/blog/open-source/tackling-structural-racism-and-sexism-in-open-so#the-impasse" class="hash-link" aria-label="Direct link to The impasse" title="Direct link to The impasse" translate="no">​</a></h2>
<p>All in all, I realised we're at an impasse: As open-source maintainers, we're never going to get feedback about how to be more welcoming, because the very nature of the problem is that people are too intimidated to show up, let alone give us that feedback.</p>
<p>From the inside of a project, with the <a href="https://hbr.org/2006/12/the-curse-of-knowledge" target="_blank" rel="noopener noreferrer" class="">curse of knowledge</a> it's hard to know what needs to be explained or documented, what context is missing from a ticket.</p>
<p>I know that these feelings of intimidation or imposter syndrome are not limited to people from minority backgrounds. Opening up this feedback loop and starting to resolve these issues is going to benefit everyone.</p>
<p>So where do we start?</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="new-contributors-ensemble">New contributors ensemble<a href="https://cucumber.io/blog/open-source/tackling-structural-racism-and-sexism-in-open-so#new-contributors-ensemble" class="hash-link" aria-label="Direct link to New contributors ensemble" title="Direct link to New contributors ensemble" translate="no">​</a></h2>
<p>It’s early days for this initiative. Our fledgeling strategy is to focus on the experience of new contributors, to open channels for feedback as well as providing coaching and mentoring for anyone who is curious about taking their first steps in open source.</p>
<p>One of the things we’re trying that feels right is the <strong>new contributors ensemble</strong>.</p>
<p>A group of willing volunteers who are keen to take their first steps in open source, and don’t look like me, are meeting on Fridays for an ensemble/mob programming session. We’ll be working together to fix one of Cucumber-JS’s <a href="https://github.com/cucumber/cucumber-js/contribute" target="_blank" rel="noopener noreferrer" class="">good first issues</a>, streaming live on <a href="https://www.twitch.tv/cucumberbdd" target="_blank" rel="noopener noreferrer" class="">https://www.twitch.tv/cucumberbdd</a> from <a href="https://www.timeanddate.com/worldclock/fixedtime.html?msg=Cucumber+new+contributor+ensemble&amp;iso=20210806T1630&amp;p1=1440&amp;ah=1&amp;am=30" target="_blank" rel="noopener noreferrer" class="">16:30 UTC</a>.</p>
<p>Like a usability test, this is a great way for me to see, in real-time, what gets in the way of a newcomer becoming a contributor. We had one a couple of weeks ago which everyone thoroughly enjoyed, but I forgot to hit the record button so you'll have to take my word for it! I'll try and be better set up this time.</p>
<p>We’d like to make this a regular event, with lots of people showing up to learn and teach each other about contributing to open source projects, not necessarily Cucumber!</p>
<p>Watch the stream to pick up some tips for yourself about how to get started in open source or, if you’re interested in taking part, get in touch. The easiest way for us would be if you join the <a class="" href="https://cucumber.io/community#slack">Cucumber Community Slack</a> and find us in the <a href="https://cucumberbdd.slack.com/archives/C028E2TBDJQ" target="_blank" rel="noopener noreferrer" class="">#new-contributors</a> channel, but you can also <a href="https://twitter.com/mattwynne/" target="_blank" rel="noopener noreferrer" class="">ping me on Twitter</a>, my DMs are open.</p>
<p>If you have any other ideas or experiences to share about this topic, I'd love to hear from you.</p>]]></content>
        <author>
            <name>Matt Wynne</name>
            <uri>https://mattwynne.net</uri>
        </author>
        <category label="Anti-Racism" term="Anti-Racism"/>
        <category label="Feminism" term="Feminism"/>
        <category label="Open Source" term="Open Source"/>
        <category label="Racism" term="Racism"/>
        <category label="Sexism" term="Sexism"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How can Cucumber help us understand the root causes of failure?]]></title>
        <id>https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause</id>
        <link href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause"/>
        <updated>2021-06-16T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[I’m continuing to answer questions that were asked during my session “Are BDD and test automation the same thing?” at the Automation Guild conference in February 2021. This is the last of five posts.]]></summary>
        <content type="html"><![CDATA[<p>I’m continuing to answer questions that were asked during my session <a href="https://www.slideshare.net/sebrose/are-bdd-and-test-automation-the-same-thing-automation-guild-2021" target="_blank" rel="noopener noreferrer" class="">“Are BDD and test automation the same thing?”</a> at the <a href="https://guildconferences.com/ag-2021/" target="_blank" rel="noopener noreferrer" class="">Automation Guild conference</a> in February 2021. This is the last of five posts.</p>
<ol>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team/">Why should automation be done by the dev team?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove/">Isn’t the business-readable documentation just extra overhead?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl/">What’s wrong with changing the scenarios to enable automation?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/can-all-testing-be-automated/">Can all testing be automated?</a></li>
<li class="">How can Cucumber help us understand the root causes of failure?</li>
</ol>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-question">The question<a href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause#the-question" class="hash-link" aria-label="Direct link to The question" title="Direct link to The question" translate="no">​</a></h2>
<blockquote>
<p>Specific about Cucumber reporting. I find that sometimes a single bug can break several Given-When-Then scenarios, which is great to measure business impact, but not great to understand root-causes/bugs. Any ideas on this? We ended up creating a complementary root-cause report...?</p>
</blockquote>
<p>This is a very interesting question that requires us to think about the purpose of our tests. You’ll probably be familiar with the popular test characterisations of unit, integration, and end-to-end – as well as many more.</p>
<p>Do we need unit tests AND end-to-end tests? If so, what different concerns do they address? If not, then which should we prefer? In answering this question, I’ll refer to two metaphors (one well known, the other less so) and an acronym.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="test-automation-pyramid">Test automation pyramid<a href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause#test-automation-pyramid" class="hash-link" aria-label="Direct link to Test automation pyramid" title="Direct link to Test automation pyramid" translate="no">​</a></h2>
<p>The test automation pyramid has been widely discussed in the industry for many years.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/fc9024e12abb89080327fd2de4614b5c534c588d852e9ef17277c046c0d44ba5-8b1ddbab54399e19d09e7b6d21d570de.png" width="602" height="394" class="img_ev3q"></p>
<p>I wrote a <a class="" href="https://cucumber.io/blog/bdd/eviscerating-the-test-automation-pyramid/">lengthy blog post</a> on the subject a few months ago, which I will not repeat here in its entirety, but there is a section that directly addresses the question:</p>
<blockquote>
<p>[Tests at the bottom of the pyramid] should exercise as little of the application as they can. These tests should document the behaviour and validate the correctness of small amounts of code. As we move up the [pyramid], we will write fewer tests, but they will exercise progressively more of the application. At the same time, the intent of the tests changes to documenting the interaction between components, the messages they pass between each other, and the protocols that they use. This includes behaviours such as validation and error handling.</p>
<p>When we reach the top of the [pyramid] we are exercising the whole application. We should already have confidence that each component behaves as intended. We should also have confidence that each interaction between components has been exercised to verify that both ends of the dependency have the same understanding of the protocol that they share. All that remains is to verify that “the system hangs together.” These are sometimes characterised as smoke tests, and they check that the application has been deployed successfully and correctly configured for that specific environment.</p>
</blockquote>
<p>The foundation of your automated testing strategy is the small, fast, reliable tests at the bottom of the pyramid. If there is a defect in the code, then it should be caught by one of these tests. Since each test at the bottom of the pyramid is validating the “correctness of a small amount of code”, we expect only a single test to fail for any given defect.</p>
<p>Many high-level tests might depend on the code that contains the defect, but we would expect the build to fail and terminate before running these high-level tests. The foundation has been found to be defective – so there is no point running tests that depend on the foundation being sound.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="test-automation-iceberg">Test automation iceberg<a href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause#test-automation-iceberg" class="hash-link" aria-label="Direct link to Test automation iceberg" title="Direct link to Test automation iceberg" translate="no">​</a></h2>
<p>If the low-level, programmer tests fail, then it is almost never worth invoking Cucumber, but this doesn’t necessarily fix the problem encountered by our questioner. In <a href="http://claysnow.co.uk/the-testing-iceberg/" target="_blank" rel="noopener noreferrer" class="">another blog post</a>, I document an insight that my colleague Matt Wynne shared with me some years ago, which he called the test automation iceberg. The one-line summary of that post is that:</p>
<p><em>Not all Business-readable tests need to be End-to-end and not all End-to-end tests need to be business readable</em></p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/bd15f668fb863f28069361fff1fb5f27ee33a9629889d9886455c6a54ebff688-1edf199470f241814d3e382cbca1c043.png" width="2080" height="1698" class="img_ev3q"></p>
<p>So, Cucumber scenarios may be implemented to run anywhere in the test automation pyramid. The use of business-readable scenarios tells us only that the behaviour is of interest to the business – it says nothing about how the test itself is automated.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="brief">BRIEF<a href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause#brief" class="hash-link" aria-label="Direct link to BRIEF" title="Direct link to BRIEF" translate="no">​</a></h2>
<p>In the second volume of the <a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">BDD Books series</a>, <strong><em>Formulation</em></strong>, <a href="https://www.linkedin.com/in/gasparnagy/" target="_blank" rel="noopener noreferrer" class="">Gáspár Nagy</a> and I introduce the <a class="" href="https://cucumber.io/blog/bdd/keep-your-scenarios-brief/">BRIEF acronym</a>. The last letter in the acronym, “F”, stands for “focused” which we describe in this way:</p>
<p><strong><em>Focused:</em></strong> <em>Most scenarios should be focused on illustrating a single rule.</em></p>
<p>What this means is that we should attempt to implement our scenario automation as far down the pyramid as possible, to ensure that we are validating a single behaviour. If there’s a defect in the implementation of that behaviour then only one (or a few related) scenarios should fail. This gets to the heart of the original question.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/f6c82f607c3eb69e42f9c386b5f5b6e64e00df0a60510c0e83dfd9f60a75f0ee-f5ab1ded588ff40211269b826fb82185.png" width="400" height="520" class="img_ev3q"></p>
<p>In <strong><em>Formulation</em></strong>, we differentiate between <em>illustrative</em> scenarios (that are focused on a single rule) and <em>journey</em> scenarios (that document a flow through several/many behaviours of the system). If illustrative and journey scenarios are run at the same time, then a defect in the implementation of a single behaviour may cause the failure of many journey scenarios. Cucumber provides several mechanisms for separating your scenarios into discrete suites that can be executed independently (see the <a href="https://school.cucumber.io/" target="_blank" rel="noopener noreferrer" class="">free training video <em>BDD with Cucumber</em></a>, chapter 6 for some suggestions). <a href="https://www.linkedin.com/in/aslak/" target="_blank" rel="noopener noreferrer" class="">Aslak Hellesøy</a> has also <a href="https://www.youtube.com/watch?v=PE_1nh0DdbY" target="_blank" rel="noopener noreferrer" class="">described how a hexagonal architecture can be leveraged to implement illustrative scenarios at several locations within the pyramid</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>The foundation of an automated testing strategy should be built from the small, fast, reliable programmer tests that are popularly called unit tests. When there’s a defect in the code, you should expect one (or perhaps a few) of these tests to fail – not many. If any of these tests fail, then the foundation is unsound, and it is not worth running the higher level tests that are built on top of this broken foundation.</p>
<p>If a single defect is causing many unrelated tests to fail, then it is likely that you are either:</p>
<ul>
<li class="">running tests higher up the pyramid, even though lower-level tests have already failed, or</li>
<li class="">you are missing the necessary lower-level tests that validate the behaviour in which the defect is located.</li>
</ul>
<p>In summary, Cucumber is a tool designed to support BDD. It will parse business-readable specifications and, in response to each statement, execute relevant automation code that your team has written. To minimise the need for costly root-cause analysis when a defect is introduced, follow the test automation pyramid metaphor and the BRIEF acronym.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="post-script">Post-script<a href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause#post-script" class="hash-link" aria-label="Direct link to Post-script" title="Direct link to Post-script" translate="no">​</a></h2>
<p>I salute the original questioner for their implementation of a <em>root-cause report</em> but suggest that it might have been better to have instead written sufficient lower-level checks to catch these defects. Whether the checks should be implemented directly in the programming language of the application (programmer tests) or using business domain terminology (Cucumber scenarios) should depend on whether the business is sufficiently interested in the behaviour that the check documents.</p>
<p>Further, I compliment the original questioner for the correct usage of the often-misspelled word <em>complementary</em>.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Interview with Seb Rose and Gáspár Nagy]]></title>
        <id>https://cucumber.io/blog/bdd/interview-with-seb-rose-and-gaspar-nagy</id>
        <link href="https://cucumber.io/blog/bdd/interview-with-seb-rose-and-gaspar-nagy"/>
        <updated>2021-06-02T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Seb Rose and Gáspár Nagy are the authors of The BDD Books. Cucumber Community Manager Tracey S. Rosenberg spoke to them about their books, the writing process, and what comes next.]]></summary>
        <content type="html"><![CDATA[<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/fca9af70205c98fee66a1d52c85d44069d3d2fc43d4b55dbc698f0731eb2089e-17dcde1b01a87e0d604bc216714595e5.png" width="792" height="463" class="img_ev3q"></p>
<p><em>Seb Rose and Gáspár Nagy are the authors of The <a href="https://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">BDD Books</a>. Cucumber Community Manager Tracey S. Rosenberg spoke to them about their books, the writing process, and what comes next.</em></p>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="tracey-how-did-you-decide-let-us-write-books-together-about-bdd-where-did-this-all-come-from-whats-the-origin-story">Tracey: How did you decide, “Let us write books together about BDD?” Where did this all come from? What’s the origin story?<a href="https://cucumber.io/blog/bdd/interview-with-seb-rose-and-gaspar-nagy#tracey-how-did-you-decide-let-us-write-books-together-about-bdd-where-did-this-all-come-from-whats-the-origin-story" class="hash-link" aria-label="Direct link to Tracey: How did you decide, “Let us write books together about BDD?” Where did this all come from? What’s the origin story?" title="Direct link to Tracey: How did you decide, “Let us write books together about BDD?” Where did this all come from? What’s the origin story?" translate="no">​</a></h4>
<p>Seb: At some point, maybe five years ago, maybe longer, Gáspár was thinking about a SpecFlow book and got in touch with Cucumber. The rest of the team said, “Seb, you could work with Gáspár on the SpecFlow book!” And I said, “That'd be wonderful.”</p>
<p>Gáspár: It was at least six years ago, definitely. When we were less busy ⁠–⁠ or we thought we were less busy! ⁠–⁠ we started to shape the form of the SpecFlow book. We wanted to make a new structure emphasizing all the goodness experienced by the BDD community regarding the BDD concept, and of course also how SpecFlow works. Discovery and formulation are not tool-specific, so we knew they shouldn’t go into a SpecFlow book. Also, discovery and formulation are separate activities. Because of this, we decided to write a separate book for each BDD practice.</p>
<p>Seb: We also realized that one big book was going to take one hell of a long time. So if we wrote a small book, we’d be able to get it done more quickly.</p>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="tracey-did-you-collaborate-on-all-the-different-parts-of-every-book-or-did-one-of-you-say-you-put-an-outline-together-and-ill-do-the-full-write-up">Tracey: Did you collaborate on all the different parts of every book, or did one of you say, you put an outline together and I'll do the full write-up?<a href="https://cucumber.io/blog/bdd/interview-with-seb-rose-and-gaspar-nagy#tracey-did-you-collaborate-on-all-the-different-parts-of-every-book-or-did-one-of-you-say-you-put-an-outline-together-and-ill-do-the-full-write-up" class="hash-link" aria-label="Direct link to Tracey: Did you collaborate on all the different parts of every book, or did one of you say, you put an outline together and I'll do the full write-up?" title="Direct link to Tracey: Did you collaborate on all the different parts of every book, or did one of you say, you put an outline together and I'll do the full write-up?" translate="no">​</a></h4>
<p>Seb: My time was in short supply when we were doing the first book, so I said, Gáspár, you write it and I’ll review it. We reversed that for the second book. Gáspár will write the third book, which is about SpecFlow. We have a fourth planned as well ⁠–⁠ in the style of <em>97 Things Every Architect Should Know</em>, we’ll seek contributions from the community and edit them into a book of styles/patterns.</p>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="tracey-and-how-does-your-process-work">Tracey: And how does your process work?<a href="https://cucumber.io/blog/bdd/interview-with-seb-rose-and-gaspar-nagy#tracey-and-how-does-your-process-work" class="hash-link" aria-label="Direct link to Tracey: And how does your process work?" title="Direct link to Tracey: And how does your process work?" translate="no">​</a></h4>
<p>Gáspár: Almost every week for the last few years, we’ve spent at least an hour together and discussed what was happening. Then we try to make progress on the book, so it’s good to have allocated time to work together. We realized it didn’t make sense to write the book together, so that's why we use this “one writes, the other reviews” scheme. But we also need to discuss these things. Even more importantly, we need the inspiration to move on. Book writing is not easily motivational, because it takes a long time.</p>
<p>Tracey: Oh yes it does.</p>
<p>Gáspár: And even after that, you don't really see your readers, or maybe you see a few of them. So one of the important bits was that during these sessions, we were asking each other, how much have you finished? If you do that a couple of times, you feel that now, this week, I should really do something.</p>
<p>Seb: There's definitely guilt. You go to a meeting on a Friday and you think, “I haven't done what I said I was going to do last Friday.” But that’s life.</p>
<p>Gáspár: We're all equal from this perspective.</p>
<p>Seb: In terms of logistics, Gáspár does all the technical work of putting the books together and getting them onto Kindle, after I’ve turned all the text into something close to English. I do the marketing.</p>
<p>Gáspár: For the cover design, I put a draft together, and we were thinking about replacing it with something more professional, but then we decided it wasn’t necessary. For the second book, we used the same concept as the first ⁠–⁠ basically, we have geometrical colours in the background, and an antique which shows the beauty of engineering. On the first one we had a compass, and then for this one, we have a very nice pen. I don't know what will happen with the third book. I'll figure it out.</p>
<p>Seb: I think we can get one of those, you know, where they used to make solar systems that you wound up and turned round. That's a few years off, though!</p>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="tracey-how-has-the-reception-been-not-just-raw-sales-but-comments-or-praise-or-why-didnt-you-do-this">Tracey: How has the reception been? Not just raw sales, but comments, or praise, or “why didn't you do this?”<a href="https://cucumber.io/blog/bdd/interview-with-seb-rose-and-gaspar-nagy#tracey-how-has-the-reception-been-not-just-raw-sales-but-comments-or-praise-or-why-didnt-you-do-this" class="hash-link" aria-label="Direct link to Tracey: How has the reception been? Not just raw sales, but comments, or praise, or “why didn't you do this?”" title="Direct link to Tracey: How has the reception been? Not just raw sales, but comments, or praise, or “why didn't you do this?”" translate="no">​</a></h4>
<p>Gáspár: For the second book, it was easier, maybe because we had a little bit of history, or maybe we were handling the review process better. Generally the review comments were positive, and in general, we got nice feedback from many people. I think our praise quote list is two pages long! It was clear these people were really checking out the book, not just writing a few sentences because we asked them. We’ve also had good feedback from the readers.</p>
<p>Seb: When we wrote Discovery, we pinged <a href="https://dannorth.net/about/" target="_blank" rel="noopener noreferrer" class="">Daniel Terhorst-North</a> and asked him to either review the book or give us feedback. His response was, “Sure, I’ll help you promote it on Twitter.” So it's like, okay, that's nice. This time we asked him for a praise quote, a sentence or two, and he wrote back and sent us a foreword! So if Dan feels like it's worth him writing a foreword, when he hasn't even been asked for one, that's good feedback. I was well happy with that.</p>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="tracey-high-praise-indeed-so-what-makes-this-book-worth-reading-if-youre-trying-to-improve-your-bdd-skills">Tracey: High praise indeed. So what makes this book worth reading, if you’re trying to improve your BDD skills?<a href="https://cucumber.io/blog/bdd/interview-with-seb-rose-and-gaspar-nagy#tracey-high-praise-indeed-so-what-makes-this-book-worth-reading-if-youre-trying-to-improve-your-bdd-skills" class="hash-link" aria-label="Direct link to Tracey: High praise indeed. So what makes this book worth reading, if you’re trying to improve your BDD skills?" title="Direct link to Tracey: High praise indeed. So what makes this book worth reading, if you’re trying to improve your BDD skills?" translate="no">​</a></h4>
<p>Gáspár: We didn't want a book which says, “This is the way you should do it, and if you don't do it that way, you’re doing it wrong.” That kind of approach is far from how Seb and I work. But it’s not easy to show the real trade-offs that teams have to choose between.</p>
<p>In both books, we have a team ⁠–⁠ they’re working on an imaginary product called Where is my Pizza? ⁠–⁠ and this team is trying to solve concrete problems. They have options, they debate, and sometimes they say, well, we can't even make a decision about that.</p>
<p>The imaginary conversations crystallised our understanding of the doubts that teams experience. Sometimes we include extra material to cover some areas in more detail. If we can imagine a real team having these sorts of discussions, it probably makes sense to the readers, or at least gets a little bit closer to the kind of discussions teams have.</p>
<p>It was funny, because over the six years we were writing these books, the characters began living their own lives. Sometimes I imagine what Dave would say, or what Tracey requires ⁠–⁠ we have a Tracey as well, by the way.</p>
<p>Tracey: Fantastic!</p>
<p>Gáspár: Maybe at some point we’ll do a dramatization of the book.</p>
<p>Seb: There’s an audiobook of <a href="https://www.amazon.co.uk/Discovery-Explore-Behaviour-Using-Examples/dp/B07VDBBDJ1/" target="_blank" rel="noopener noreferrer" class="">Discovery</a>.</p>
<p>Gáspár: It’s also worth reading because formulation is a very practical topic. Everyone who deals with BDD needs to sit down and write the “given, when, then” sentences. I remember my own feelings, ten or eleven years ago, where we were not prepared for that ⁠–⁠ we just came together in a meeting and wrote the first scenario. We started with "given” and then said, “uh oh, wait a second, ah, how should this go?” I think that's a situation many people face. Obviously the discovery part is important, but to make the connection to discovery, formulation is the immediate need. People have to understand how to write down and create these scenarios. Hopefully the book gives enough guidance for that. Also, it shows that when you put more of the discovery practice into your process, it becomes even easier.</p>
<p>Seb: There's been quite a lot of development in the BDD field over the time that we’ve been writing this book. This idea of discovery, formulation, and automation comes out of writing these books. It was inspired by the work of <a href="http://lunivore.com/" target="_blank" rel="noopener noreferrer" class="">Liz Keogh</a>, but Gáspár came up with the term “formulation”, and I suggested we divide the SpecFlow book into three books, aligned with discovery, formulation, and automation. That fed into the diagram Matt Wynne eventually created for the BDD documentation on the <a class="" href="https://cucumber.io/docs/bdd/">cucumber.io</a> site.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/777e721f62aff48bbbf6aa557c7e1c8d72b8bec897fde5d956538f00d5f06d50-c4bf06679ffdab873b7dc5393716aa80.png" width="1009" height="817" class="img_ev3q"></p>
<p><em>Discovery, Formulation, and Automation</em></p>
<p>Seb: These books don't simply document what we've done, or what other people have done ⁠–⁠ they’re part of the evolution of BDD. Gáspár came up with the term “formulation” around six years ago, and no one had used it in this way before. In fact, when we called the great and the good of the BDD world together, there was a lot of pushback against the term. People wanted to call it specification or whatever. We said, fine, everyone do what they want, but we carried on calling it formulation, and that's the word that stuck. So yeah, go us! Go Gáspár!</p>
<p>Gáspár: To be precise, I didn’t come up with the word. I don't know who deserves credit for it. I did bring it into this community, certainly. I think it’s important that we have names for things, and that some names are unique. English words, obviously any kind of words, can be used in multiple different forms, so there is no one single meaning of a word. You could use specification, or you could use documentation ⁠–⁠ there are many words that would be fitting ⁠–⁠ but when you use a word that’s a little bit special, that reduces the confusion. If I say “specification” or “documentation,” those words are overused. “Formulation” is special, and in the BDD context, everyone knows what we’re talking about.</p>
<hr>
<p><strong><em>Discovery</em> and <em>Formulation</em> are available on:</strong></p>
<ul>
<li class="">Leanpub - where you can get both <a href="https://leanpub.com/b/bddbooks" target="_blank" rel="noopener noreferrer" class="">bundled</a> together!</li>
<li class="">Amazon - <a href="https://www.amazon.com/Formulation-Document-examples-Given-Books-ebook/dp/B093NCN3FZ/ref=sr_1_1?dchild=1&amp;keywords=bdd+formulation&amp;qid=1623093017&amp;s=audible&amp;sr=1-1" target="_blank" rel="noopener noreferrer" class="">Discovery</a> and <a href="https://www.amazon.com/Formulation-Document-examples-Given-Books-ebook/dp/B093NCN3FZ/ref=sr_1_1?dchild=1&amp;keywords=bdd+formulation&amp;qid=1623093017&amp;s=audible&amp;sr=1-1" target="_blank" rel="noopener noreferrer" class="">Formulation</a>, with Discovery also available as an <a href="https://www.audible.com/pd/Discovery-Explore-Behaviour-Using-Examples-Audiobook/B07VDBD1PK?qid=1623092032&amp;sr=1-1&amp;ref=a_search_c3_lProduct_1_1&amp;pf_rd_p=83218cca-c308-412f-bfcf-90198b687a2f&amp;pf_rd_r=4KFYXBZCNPXE5253GHG8" target="_blank" rel="noopener noreferrer" class="">audiobook</a> at Audible.</li>
<li class="">For more from Seb and Gáspár, check out their Test Guild talk, “<a href="https://testguild.com/bdd-automation-testing/" target="_blank" rel="noopener noreferrer" class="">BDD is not Automation Testing</a>” and follow them on Twiter at <a href="https://twitter.com/sebrose" target="_blank" rel="noopener noreferrer" class="">@sebrose</a> and <a href="https://twitter.com/gasparnagy" target="_blank" rel="noopener noreferrer" class="">@gasparnagy</a>.</li>
</ul>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/fe358c2fc7d860934b36e15aa57377f144dcdc2d6ac976ab91131647db6593b3-cccc602231b1d4111716ead90de2d9cf.png" width="489" height="680" class="img_ev3q"></p>]]></content>
        <author>
            <name>Tracey S. Rosenberg</name>
        </author>
        <category label="BDD" term="BDD"/>
        <category label="Books" term="Books"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Can all testing be automated?]]></title>
        <id>https://cucumber.io/blog/bdd/can-all-testing-be-automated</id>
        <link href="https://cucumber.io/blog/bdd/can-all-testing-be-automated"/>
        <updated>2021-05-24T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[I’m continuing to answer questions that were asked during my session “Are BDD and test automation the same thing?” at the Automation Guild conference in February 2021. This is the fourth of five posts.]]></summary>
        <content type="html"><![CDATA[<p>I’m continuing to answer questions that were asked during my session <a href="https://www.slideshare.net/sebrose/are-bdd-and-test-automation-the-same-thing-automation-guild-2021" target="_blank" rel="noopener noreferrer" class="">“Are BDD and test automation the same thing?”</a> at the <a href="https://guildconferences.com/ag-2021/" target="_blank" rel="noopener noreferrer" class="">Automation Guild conference</a> in February 2021. This is the fourth of five posts.</p>
<ol>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team/">Why should automation be done by the dev team?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove/">Isn’t the business-readable documentation just extra overhead?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl/">What’s wrong with changing the scenarios to enable automation?</a></li>
<li class="">Can all testing be automated?</li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause/">How can Cucumber help us understand the root causes of failure?</a></li>
</ol>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-question">The question<a href="https://cucumber.io/blog/bdd/can-all-testing-be-automated#the-question" class="hash-link" aria-label="Direct link to The question" title="Direct link to The question" translate="no">​</a></h2>
<blockquote>
<p>Isn't the goal of repeatability for refactoring confidence, not test confidence?</p>
</blockquote>
<p>In the presentation I gave at the Test Automation Guild conference, I compared traditional test automation to Behaviour-Driven Development. I used a scene from one of my favourite movies, <a href="https://en.wikipedia.org/wiki/Kelly%27s_Heroes" target="_blank" rel="noopener noreferrer" class="">Kelly’s Heroes</a>, to describe the inherent risk that comes from excessive reliance on our automated tests. More on that later.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/66909570000d31661295c7e7e9b3a7c85daf2e382acf72fbcc096b2ff4da3781-651443fa15ae32c0a5e523a466d896a7.png" width="451" height="282" class="img_ev3q"></p>
<p>This question hints at the tension between automated tests and confidence in our software. How many tests is enough? What sort of tests give us the most useful information? Where is the sweet spot that maximises the return on automated test investment?</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="repeatability">Repeatability<a href="https://cucumber.io/blog/bdd/can-all-testing-be-automated#repeatability" class="hash-link" aria-label="Direct link to Repeatability" title="Direct link to Repeatability" translate="no">​</a></h2>
<p>I’ve written at length about the <a class="" href="https://cucumber.io/blog/bdd/eviscerating-the-test-automation-pyramid/">test automation pyramid</a>, so I’ll not repeat most of that here. There is an important conclusion that I do want to summarise, and it’s this:</p>
<p><em>We invest in small, fast, repeatable tests (at the bottom of the pyramid) because they only fail when there’s a problem with <strong>the thing that they were created to test</strong></em></p>
<p>They shouldn’t fail because some other part of the software has a problem. They shouldn’t fail because some external service is having a temporary outage.</p>
<p>This means that we will avoid the flickering test - the scourge of automated tests. When one of these tests fails, we can be confident that there really is a problem in that specific part of the software. And finally, the amount of debugging detective work that we’ll need to do is minimised.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="minefields">Minefields<a href="https://cucumber.io/blog/bdd/can-all-testing-be-automated#minefields" class="hash-link" aria-label="Direct link to Minefields" title="Direct link to Minefields" translate="no">​</a></h3>
<p>In Kelly’s Heroes the platoon wander into a minefield. Everything seems fine until one unlucky soldier steps on a mine. To get out safely, the person that is nearest the edge of the field carefully works their way forward, probing for mines as they go. Everyone else works towards their nearest colleague. The end result is the minimal number of paths that are guaranteed to be safe.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/e54458ccc045147acb98d0325c1beae023f8af9147decf8895e2d37c23e28bc3-94432e6a761851ac562ceb9b3dfd003d.jpg" width="1381" height="818" class="img_ev3q"></p>
<p>If another platoon needs to cross that field, they could follow the paths marked out by Kelly’s platoon and be guaranteed to get across safely. That doesn’t mean that there are no mines in the field – just that, by following the safe paths, they’re guaranteed not to step on any.</p>
<p>Automated tests are like paths through the minefield. If a test does fail, then you fix the defect, and the test will now pass – every time it runs. Any defects not already detected, will never be detected by the automated tests. That’s not to suggest there is no value in the automated tests. As suggested by the original question, the continuing value of a passing automated test is to prevent a regression from creeping in (either during refactoring or during development of a new feature).</p>
<p>My friend <a href="https://twitter.com/gojkoadzic" target="_blank" rel="noopener noreferrer" class="">Gojko Adzic</a> has spoken about the decreasing value of an automated test over time. <a href="https://www.amazon.co.uk/Specification-Example-Successful-Deliver-Software/dp/1617290084" target="_blank" rel="noopener noreferrer" class="">He interviewed a team at uSwitch</a> that only ran a subset of their tests regularly. I've even come across people that suggest deleting tests if they haven’t failed for a certain period of time. Personally, I encourage teams to think of automated tests as documentation of expected system behaviour. Only delete a test if it doesn’t contribute to an overall understanding of how the system is intended to behave.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="explore">Explore!<a href="https://cucumber.io/blog/bdd/can-all-testing-be-automated#explore" class="hash-link" aria-label="Direct link to Explore!" title="Direct link to Explore!" translate="no">​</a></h3>
<p>To be confident that your system will behave correctly in all possible situations, perhaps you might consider exhaustively testing every possible path through the software, using every possible data value. It doesn’t take long to see that this is impractical. Instead, testers frequently reduce the test space by using partitioning techniques that can dramatically reduce the number of tests needed, without massively reducing your confidence in the outcomes.</p>
<p>Even so, given the inherent complexity of modern software systems, there are many modes of failure that are hard (or impossible) to predict. Therefore, test plans and automated tests will naturally not catch many categories of defects. One widely accepted approach to rooting out these sorts of problems is called <a href="https://www.agilealliance.org/glossary/exploratory-testing/" target="_blank" rel="noopener noreferrer" class="">Exploratory Testing</a> – as described in the excellent book <em><a href="https://www.amazon.co.uk/Explore-Increase-Confidence-Exploratory-Testing/dp/1937785025" target="_blank" rel="noopener noreferrer" class="">Explore It!</a></em> by <a href="https://twitter.com/testobsessed" target="_blank" rel="noopener noreferrer" class="">Elisabeth Hendrickson</a>.</p>
<p>From my perspective, the key aspects of Exploratory Testing that should be kept in mind are:</p>
<ul>
<li class="">It’s a job for an experienced tester
<ul>
<li class="">Testers with relevant domain knowledge are ideal</li>
</ul>
</li>
<li class="">It’s not a checkbox activity
<ul>
<li class="">Ongoing exploration as the product evolves is essential</li>
</ul>
</li>
<li class="">It complements automated testing
<ul>
<li class="">Refer to the Agile Testing Quadrant from Janet Gregory and Lisa Crispin’s <em>Agile Testing</em> book</li>
</ul>
</li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="alternatives">Alternatives<a href="https://cucumber.io/blog/bdd/can-all-testing-be-automated#alternatives" class="hash-link" aria-label="Direct link to Alternatives" title="Direct link to Alternatives" translate="no">​</a></h3>
<p>As well as exploratory testing, there are many other approaches to reducing the likelihood of defects in your software. A few of them (in no particular order) are:</p>
<ul>
<li class=""><a href="https://en.wikipedia.org/wiki/Mutation_testing" target="_blank" rel="noopener noreferrer" class="">Mutation testing</a> – tooling that injects defects into the codebase, one decision point at a time (to create a mutant). The automated tests are run against each mutant – if no tests fail then there’s something missing from the test suite.</li>
<li class=""><a href="https://en.wikipedia.org/wiki/Chaos_engineering" target="_blank" rel="noopener noreferrer" class="">Chaos engineering</a> – interfering with running systems to ensure that they are resilient in the face of degradation and failure.</li>
<li class=""><a href="https://en.wikipedia.org/wiki/Blue-green_deployment" target="_blank" rel="noopener noreferrer" class="">Blue/Green deployments</a> – deploying the latest version of the system in parallel with the current version. A proportion of users are then directed to the latest version and are monitored to ensure that users are still able to achieve expected outcomes.</li>
<li class=""><a href="https://gregdonald.com/articles/stack-trace-driven-development" target="_blank" rel="noopener noreferrer" class="">Stack-trace driven development</a> – ship the software without testing it and let your users report defects to you.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://cucumber.io/blog/bdd/can-all-testing-be-automated#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>Repeatability of automated test is needed for confidence in the quality of the software and the quality of the tests. The first thing that happens when an automated test begins to fail intermittently is that confidence in the test suite as a whole begins to suffer (see the <a href="https://en.wikipedia.org/wiki/Broken_windows_theory" target="_blank" rel="noopener noreferrer" class="">Broken Windows theory</a>).</p>
<p>The challenge with a finite suite of automated tests is that they continually check exactly the same paths through the software. By definition, therefore, they can’t detect defects that lie off those paths. There are a host of approaches that you might adopt, based upon your organisation’s attitude to risk, but the most effective is often to supplement automated testing with exploratory testing.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[What's wrong with changing the scenarios to enable automation?]]></title>
        <id>https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl</id>
        <link href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl"/>
        <updated>2021-05-04T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[I’m continuing to answer questions that were asked during my session “Are BDD and test automation the same thing?” at the Automation Guild conference in February 2021. This is the third of five posts.]]></summary>
        <content type="html"><![CDATA[<p>I’m continuing to answer questions that were asked during my session <a href="https://www.slideshare.net/sebrose/are-bdd-and-test-automation-the-same-thing-automation-guild-2021" target="_blank" rel="noopener noreferrer" class="">“Are BDD and test automation the same thing?”</a> at the <a href="https://guildconferences.com/ag-2021/" target="_blank" rel="noopener noreferrer" class="">Automation Guild conference</a> in February 2021. This is the third of five posts.</p>
<ol>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team/">Why should automation be done by the dev team?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove/">Isn’t the business-readable documentation just extra overhead?</a></li>
<li class="">What’s wrong with changing the scenarios to enable automation?</li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/can-all-testing-be-automated/">Can all testing be automated?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause/">How can Cucumber help us understand the root causes of failure?</a></li>
</ol>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-question">The question<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#the-question" class="hash-link" aria-label="Direct link to The question" title="Direct link to The question" translate="no">​</a></h2>
<blockquote>
<p>Why many times I find myself changing the BDD statements once I start automation, as there is certain information needed between steps? BDD framework is supposed to involve many stakeholders and yet I feel the statements are to be written in a very stringent fashion.</p>
</blockquote>
<p>This is a question that gets right to the heart of the tension between specification and automation. <a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">Gáspár Nagy and I wrote Formulation</a> to focus on the art of writing good executable specifications. One of the core messages, which warrants its own section, is that “readability trumps ease of automation”.</p>
<p>I’ll be describing some automation techniques while answering this question. There’s a wide variety of languages that are available for automating specifications, but I’ve chosen to write the examples using Java. The techniques are applicable no matter what language you use for automation.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="readability">Readability<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#readability" class="hash-link" aria-label="Direct link to Readability" title="Direct link to Readability" translate="no">​</a></h2>
<p>The goal of business-readable specifications is to facilitate and encourage collaboration between the business team and the delivery team. Over many years, we have identified six properties that we believe most scenarios should conform to – and captured them in a five-letter acronym: BRIEF.</p>








































<table><thead><tr><th></th><th>Name</th><th>Meaning</th></tr></thead><tbody><tr><td>B</td><td>Business language</td><td>Business terminology aids cross-discipline collaboration</td></tr><tr><td>R</td><td>Real data</td><td>Using actual data helps reveal assumptions and edge cases</td></tr><tr><td>I</td><td>Intention revealing</td><td>Describe the desired outcomes, rather than the mechanism of how they are achieved</td></tr><tr><td>E</td><td>Essential</td><td>Omit any information that doesn’t directly illustrate behaviour</td></tr><tr><td>F</td><td>Focused</td><td>Each scenario should only illustrate a single rule</td></tr><tr><td></td><td>Brief</td><td>Shorter scenarios are easier to read, understand and maintain</td></tr></tbody></table>
<p>The benefits of business-readable specifications are numerous (and covered in a <a class="" href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove/">previous post</a>), but two of the BRIEF properties are worth expanding on.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="focused">Focused<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#focused" class="hash-link" aria-label="Direct link to Focused" title="Direct link to Focused" translate="no">​</a></h3>
<p>The majority of scenarios exist to clarify and illustrate how one business rule is expected to behave when implemented. Every application is made up of many thousands of interacting business rules, so we decompose specifications into the individual rules and illustrate each rule with one or more scenarios. These are called <em>illustrative scenarios</em>.</p>
<p>There is also value in scenarios that cover the interactions of multiple rules, or even a complete user journey. These are called <em>journey scenarios</em> and will not be covered in this article.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="essential">Essential<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#essential" class="hash-link" aria-label="Direct link to Essential" title="Direct link to Essential" translate="no">​</a></h3>
<p>When we write an illustrative scenario, we need to constrain ourselves to presenting the reader with information that is pertinent to the rule being illustrated. Any information that doesn’t contribute to a reader’s understanding of how the rule should behave is incidental and inessential.</p>
<p>It is very tempting to include information that is necessary for the application to work even if that information does nothing to clarify the specific behaviour of the rule being illustrated. If we give in to this temptation, there are a couple of bad side effects:</p>
<ul>
<li class="">It’s harder to read the specification – more data is being presented and it’s not clear which data is essential to the rule’s behaviour</li>
<li class="">The specification becomes more brittle – the scenario may need to be changed when some part of the application unconnected to the rule that it illustrates changes</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="automation">Automation<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#automation" class="hash-link" aria-label="Direct link to Automation" title="Direct link to Automation" translate="no">​</a></h2>
<p>Once the team has formulated a scenario to conform to the BRIEF properties, it should be our aim to automate it without having to introduce inessential information. There are many approaches and techniques to automate any scenario <strong>without</strong> having to change the text in any way. Here I present a high level overview of a few of them.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="passing-data-between-steps">Passing data between steps<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#passing-data-between-steps" class="hash-link" aria-label="Direct link to Passing data between steps" title="Direct link to Passing data between steps" translate="no">​</a></h3>
<p>Every implementation of Cucumber has a mechanism for passing data between steps.</p>
<ul>
<li class="">Cucumber Ruby and JavaScript <a class="" href="https://cucumber.io/docs/cucumber/state/">use a World object</a> which each step can interact with to attach or access information. Many other flavours of Cucumber use a similar mechanism.</li>
<li class="">Cucumber Java <a class="" href="https://cucumber.io/docs/cucumber/state/">uses dependency injection (DI)</a> to share a single instance of an object between different step definition classes.</li>
<li class="">SpecFlow supports <a href="https://docs.specflow.org/projects/specflow/en/latest/Bindings/Sharing-Data-between-Bindings.html" target="_blank" rel="noopener noreferrer" class="">multiple mechanisms for sharing data</a>.</li>
</ul>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/0faf493b12ceb43e0a69d12900b94b7a1fa7742abc17fb2acc4a952d1aacd913-2a2295e5fdef745a3ea9f431d9c29f1e.png" width="451" height="110" class="img_ev3q"></p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/b995b9ee4ced952299a063c751c35b33ab184529c482dd3d4bf3e29aef5dc7ea-b1fb367b94e19fe043d59847f0a123c7.png" width="451" height="100" class="img_ev3q"></p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/be33ef71547bf38c82b22007f556dc84a05860db38f9551dbe32e34f955904d2-1488b47b7498f2fb47ade8d786e5d418.png" width="451" height="234" class="img_ev3q"></p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/78a230b13ddbd9b89c7644aba9284d88da52fd8b47c5362893f741d47055e445-4c15387cb77949ea868c858954f81dea.png" width="451" height="246" class="img_ev3q"></p>
<p>What all implementations have in common is that the shared data is deleted after each scenario. This is to ensure that scenarios run in isolation and can’t affect each other. The obvious benefit is that you can run any scenario on its own, or any set of scenarios in any order, and the results should always be the same.</p>
<p>If you use mechanisms for sharing data or make state changes that persist after the end of a scenario (such as not rolling back database changes), then you can get unexpected test results. Cucumber has mechanisms that allow you to initiate setup and teardown activities at scenario boundaries, but it is the developer’s responsibility to remember to do this.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="behaviour-midway-through-a-user-journey">Behaviour midway through a user journey<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#behaviour-midway-through-a-user-journey" class="hash-link" aria-label="Direct link to Behaviour midway through a user journey" title="Direct link to Behaviour midway through a user journey" translate="no">​</a></h3>
<p>Most scenarios should be illustrative scenarios (as described above), and the rule they illustrate will often only be relevant at specific points on a user journey.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/1e735d0c3542bbcab037ec55b4d6c279a784beb8c501bdbf688bb0be186cbee8-b087a6c80c1880e0322c3ad43e85636a.png" width="451" height="77" class="img_ev3q"></p>
<p>It may seem reasonable to preface the scenario with all the steps required to get to the checkout page, but none of that information would help clarify the expected behaviour of the rule. Instead, there are at least three ways that the Given step of this scenario could be automated as it’s written (I’m assuming we’re dealing with a web application):</p>
<ul>
<li class="">End-to-end
<ul>
<li class="">Use Selenium (or similar) to add products to the basket, and navigate to the checkout page</li>
<li class="">A test double of the payment provider service or pre-allocated test card details would typically be used</li>
<li class="">The DOM would be inspected to verify that the expected message was shown</li>
</ul>
</li>
<li class="">Service/API level
<ul>
<li class="">Send HTTP requests to add products to the basket</li>
<li class="">A test double of the payment provider service or pre-allocated test card details would typically be used</li>
<li class="">The response payload would be inspected to verify that the expected message was returned</li>
</ul>
</li>
<li class="">Component/class level
<ul>
<li class="">Call method(s) on the relevant class(es) to add products to the basket</li>
<li class="">A test double of the payment component would return indicating success when called to authorise payment</li>
<li class="">The return value of the relevant method call would be compared to the expected value</li>
</ul>
</li>
</ul>
<p>Each of these approaches avoids the need for the scenario to contain inessential information, while allowing the team to decide the appropriate automation technique to get the desired speed of feedback and level of confidence.</p>
<p>Aslak Hellesøy and the Cucumber team regularly structure their automation code so that <a href="https://skillsmatter.com/skillscasts/9971-testable-software-architecture-with-aslak-hellesoy" target="_blank" rel="noopener noreferrer" class="">a scenario can be executed at any of these levels</a> without altering the text of the scenario.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="automating-at-the-bottom-of-the-pyramid">Automating at the bottom of the pyramid<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#automating-at-the-bottom-of-the-pyramid" class="hash-link" aria-label="Direct link to Automating at the bottom of the pyramid" title="Direct link to Automating at the bottom of the pyramid" translate="no">​</a></h3>
<p>The test automation pyramid is a popular metaphor documenting a popular and successful strategy. I recommend you read <a class="" href="https://cucumber.io/blog/bdd/eviscerating-the-test-automation-pyramid/">this article</a> even if you are fully aware of the metaphor already.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/fc9024e12abb89080327fd2de4614b5c534c588d852e9ef17277c046c0d44ba5-8b1ddbab54399e19d09e7b6d21d570de.png" width="602" height="394" class="img_ev3q"></p>
<p>In the previous section, the three approaches described live at different levels of the pyramid:</p>
<ul>
<li class="">Component/class – near the bottom
<ul>
<li class="">the detail of our code is verified using plentiful, small, fast tests</li>
<li class="">mostly come for free with test driven development (TDD)</li>
</ul>
</li>
<li class="">Service/API – somewhere in the middle
<ul>
<li class="">interaction and communication between dependent components is verified using test doubles, virtualisation, and contract tests</li>
<li class="">these tests should be less interested in the actual data than in the categories of data that are being passed e.g., null, empty, zero/positive/negative, errors &amp; exceptions</li>
</ul>
</li>
<li class="">End-to-end – near the top
<ul>
<li class="">some user journeys automated to verify that functionality is available as expected</li>
<li class="">also useful as smoke tests to ensure that deployment to an environment has been successful</li>
</ul>
</li>
</ul>
<p><a href="https://www.linkedin.com/feed/update/urn:li:activity:6632583052277137408?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A6632583052277137408%2C6633191266194681856%29" target="_blank" rel="noopener noreferrer" class="">Beth Skurrie has noted another variation</a> as you move up the pyramid:</p>
<p>".<em>.. the more code the test covers, the lighter the touch of the test should be ... it's easy to fall into the trap of asserting</em> <strong><em>more</em></strong> <em>the more code a test covers, when it's much more maintainable to be asserting</em> <strong><em>less</em></strong><em>, or at least, making more flexible assertions.</em>"</p>
<p>You’ll notice that I haven’t mentioned Behaviour-Driven Development (BDD) at all in this section. That’s because choosing whether to use developer test tools (e.g., JUnit) or natural language automation tools (e.g., Cucumber) depends on <strong>who</strong> will get value from reading the specification. So, choosing where in the pyramid you should automate should not be influenced by whether you’re using Cucumber or not. I go into this in more details in <a href="http://claysnow.co.uk/the-testing-iceberg/" target="_blank" rel="noopener noreferrer" class="">this article</a>.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="invisible-initialisation">Invisible initialisation<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#invisible-initialisation" class="hash-link" aria-label="Direct link to Invisible initialisation" title="Direct link to Invisible initialisation" translate="no">​</a></h3>
<p>Many of your scenarios will require some level of setup, no matter where in the pyramid they are automated. Even if that setup is not essential information for someone reading the specification, you’ll still need to find a mechanism to make sure it happens.</p>
<p>Examples of initialisation include:</p>
<ul>
<li class="">spinning up a local webserver or in-memory database</li>
<li class="">restoring persistent test data to a known state</li>
<li class="">creating and injecting test doubles/mocks/stubs</li>
</ul>
<p>It’s rare that these activities should be included in a scenario. I’d also recommend that they don’t belong in a feature file at all, so should not be part of a <a class="" href="https://cucumber.io/docs/gherkin/reference/#background">Background</a>.</p>
<p>Techniques that I’ve found useful are:</p>
<ul>
<li class=""><a class="" href="https://cucumber.io/docs/cucumber/api/#hooks">Cucumber (conditional) hooks</a>
<ul>
<li class="">all Cucumber implementations have <em>Before</em> and <em>After</em> hooks that are called before or after a scenario runs</li>
<li class="">some implementations have additional hooks, such as <em>BeforeStep/AfterStep</em> and <em>BeforeAll/AfterAll</em></li>
<li class="">hooks can be made conditional on the tags applied to the currently running scenario</li>
<li class="">this is the default approach that should be considered first
<ul>
<li class="">tags are part of the specification, so should always make sense to business colleagues</li>
</ul>
</li>
</ul>
</li>
<li class=""><a href="https://en.wikipedia.org/wiki/Proxy_pattern" target="_blank" rel="noopener noreferrer" class="">Proxy/surrogate design pattern</a>
<ul>
<li class="">access the resource through a proxy, that will create it when first needed</li>
<li class="">this approach should be considered when
<ul>
<li class="">there is occasional need for an object to be created</li>
<li class="">the creation is expensive, and</li>
<li class="">it is not otherwise possible to localise the object’s use</li>
</ul>
</li>
</ul>
</li>
<li class="">Instance variable (for Cucumber’s that support DI)
<ul>
<li class="">access the resource through an instance variable on an injected shared object
<ul>
<li class="">the injected shared object can also defer resource creation until first access</li>
</ul>
</li>
<li class="">Cucumber will only create the shared object when execution requires a step definition that requires it</li>
</ul>
</li>
</ul>
<p>An entity may be essential for correct running of an automated test, without being an essential ingredient of a specification whose purpose is to illustrate and clarify a business rule. These three initialisation techniques will enable you to preserve the business value of the specification, without causing an excessive burden on the automation.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="data-builders">Data builders<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#data-builders" class="hash-link" aria-label="Direct link to Data builders" title="Direct link to Data builders" translate="no">​</a></h3>
<p>Not all objects are simple to build. They may have many properties – some of which need to be manipulated to illustrate a specific rule, such as a customer that may require name, address, gender, date of birth. For scenarios where the value of these properties is unimportant, we should not need to specify them. For scenarios where it is necessary to set a specific value for only one of these properties, we should be able to do it in a way that preserves the need to only include essential information in the scenario.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/7d3d1d5b5c413c6c5a8926df9fa1af8a6db8d68ed5e1a9e47179c2d90e1142cf-e3816f55b331a887798a876f078519a3.png" width="451" height="508" class="img_ev3q"></p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/800cb607989b41ffe0772b5b218137ce840ed65784df03a4b227b7df909c828e-375b48ccdd61fa624b36f0f9e8b35f87.png" width="451" height="164" class="img_ev3q"></p>
<p>The <a href="https://en.wikipedia.org/wiki/Builder_pattern" target="_blank" rel="noopener noreferrer" class="">Builder pattern</a> supports easy creation of complex objects, typically by offering:</p>
<ul>
<li class="">A default object which can be used when specific values are not required</li>
<li class="">Overrides to set specific values for selected properties</li>
<li class="">Named objects (personas) that represent well defined sets of values (e.g., overdrawn account, domiciled overseas etc.)</li>
</ul>
<p>This approach will also work for objects that are the root of a network of connected objects, such as a customer that has multiple accounts.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>Once the formulated wording of a scenario has been agreed between business and delivery, it should not be changed unless either the business requirement it illustrates changes, or an essential omission or error is found. It should certainly not be modified to make the process of automation easier.</p>
<p>In this article, I have given an overview of five core techniques that can help simplify automation. Some of them are foundational techniques applied across all types of test automation, while others are more specific to the automation of Cucumber/SpecFlow step definitions.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Isn't the business readable documentation just overhead?]]></title>
        <id>https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove</id>
        <link href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove"/>
        <updated>2021-04-09T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[After my talk called “Are BDD and test automation the same thing?” at the Automation Guild conference in February 2021 there were more questions than I could answer in the available time. This is the second of five posts answering the five most important ones:]]></summary>
        <content type="html"><![CDATA[<p>After my talk called “Are BDD and test automation the same thing?” at the <a href="https://guildconferences.com/ag-2021/" target="_blank" rel="noopener noreferrer" class="">Automation Guild conference</a> in February 2021 there were more questions than I could answer in the available time. This is the second of five posts answering the five most important ones:</p>
<ol>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team/">Why should automation be done by the dev team?</a></li>
<li class="">Isn’t the business-readable documentation just extra overhead?</li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl/">What’s wrong with changing the scenarios to enable automation?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/can-all-testing-be-automated/">Can all testing be automated?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause/">How can Cucumber help us understand the root causes of failure?</a></li>
</ol>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-question">The question<a href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove#the-question" class="hash-link" aria-label="Direct link to The question" title="Direct link to The question" translate="no">​</a></h2>
<blockquote>
<p>Doesn't adding something like SpecFlow to interface with something like Selenium just add an extra code base that must be maintained? Does the benefit justify the extra work?</p>
</blockquote>
<p>This question directly addresses the costs and benefits of a BDD approach. Although it directly references Selenium, tools like SpecFlow always add a layer that needs to be maintained, so this post won’t mention Selenium specifically.</p>
<p><a href="https://www.linkedin.com/pulse/bdd-tasks-activities-seb-rose/" target="_blank" rel="noopener noreferrer" class="">Adopting BDD does lead to more collaboration between business and delivery teams, development of a shared vocabulary rooted in the business domain, and tooling required to automatically validate the resulting business-readable specifications.</a> What possible benefit can there be that justifies the cost of adding more interactions and more tooling?</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-cost-of-software">The cost of software<a href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove#the-cost-of-software" class="hash-link" aria-label="Direct link to The cost of software" title="Direct link to The cost of software" translate="no">​</a></h2>
<p>Software takes time (and hence money) to create. We always seem to take longer than we expected to create the software we think our customers want, so there’s a desire to go faster. Common approaches to going faster forget that software creation is a creative process, rather than a manufacturing problem. Simply cranking the handle faster introduces more bugs into the software, which leads to slower delivery.</p>
<p>Here are my top reasons for why trying to go faster results in bad outcomes:</p>
<ul>
<li class="">Misunderstood requirements – human communication is notoriously error prone. If the customer, the developers, and the testers don’t have a shared understanding of what is being asked for (and why), then we will not deliver the functionality that is needed.</li>
<li class="">Unarticulated assumptions – it is hard for experts to enumerate all of the assumptions that are foundational to their understanding of the business domain. Where assumptions remain unarticulated, misunderstandings will go unchecked.</li>
<li class="">Unnecessary code – in the absence of stable, reliable requirements, the team become used to regular context switches and rework. This frequently leads them to write overly generic code, intended to be flexible enough to handle whatever changes in behaviour the customer asks for next.</li>
<li class="">Defects &amp; regressions – misunderstandings, missed assumptions, and superfluous code are direct causes of defects and regressions. Additionally, when teams feel pressure to go faster, it’s often practices that seem to be peripheral to producing production code (such as unit testing and documentation) that are skipped, leading to even more defects. The limiting factor in software development is not a programmer’s typing speed.</li>
<li class="">Status reporting – the person paying the bills wants to know that their money is being spent wisely, but getting that information usually requires the team to spend time collecting and presenting that information in a format that the customer can understand.</li>
<li class="">Maintenance – software lasts for years or decades, and over that time has to evolve to fit the changing business landscape. Unreliable documentation, poorly structured code, and incomprehensible test scripts all contribute to inflating the total cost of ownership – and yet these are exactly the areas where short cuts are taken when a team is pressured to focus on delivery.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-benefits-of-bdd">The benefits of BDD<a href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove#the-benefits-of-bdd" class="hash-link" aria-label="Direct link to The benefits of BDD" title="Direct link to The benefits of BDD" translate="no">​</a></h2>
<p>Behaviour driven development is an agile approach to developing software, consisting of three practices applied iteratively to each increment of functionality:</p>
<ul>
<li class="">Discovery – creates a shared understanding of the requirements through collaboration, typically achieved through a structured conversation centred on rules and examples.</li>
<li class="">Formulation – examples of system behaviour are documented using business terminology.</li>
<li class="">Automation – the documentation is automated, creating living documentation that verifies the system’s behaviour.</li>
</ul>
<p>In the following sections, I’ll outline how adopting these practices can mitigate the costs described in the previous section.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="discovery">Discovery<a href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove#discovery" class="hash-link" aria-label="Direct link to Discovery" title="Direct link to Discovery" translate="no">​</a></h3>
<p><a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">Discovery</a> (aka 3 Amigos and <a class="" href="https://cucumber.io/blog/bdd/example-mapping-introduction/">Example Mapping</a>) is where the team really begins to understand how a piece of functionality should behave to deliver value to the customer. The product owner/business analyst prepare their understanding of the next small increment and the delivery team test their understanding of it using concrete examples. Through this process, detailed requirements are refined, while misunderstandings and assumptions are surfaced and resolved.</p>
<p>Discovery takes time, but the detailed shared understanding that is achieved needs to be reached <strong>no matter what approach the team takes</strong>. If the team doesn’t learn about this early, before writing code or test scripts, they will learn later and have to rework code and test scripts that they have already created. Quite apart from the time spent doing the rework, there is the huge cost of the associated <a href="https://calleia.com/2014/05/15/cost-of-context-switching/" target="_blank" rel="noopener noreferrer" class="">context switching</a>.</p>
<p>Another significant benefit of Discovery is gaining the ability to <a href="https://www.kaizenko.com/whats-the-right-size-for-a-user-story/" target="_blank" rel="noopener noreferrer" class="">right-size stories</a> because having clear, detailed requirements makes it simple to split large stories into fine-grained increments. This gives the product owner the opportunity to prioritise work at a granularity that enables cheap experiments and MVPs.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="formulation">Formulation<a href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove#formulation" class="hash-link" aria-label="Direct link to Formulation" title="Direct link to Formulation" translate="no">​</a></h3>
<p>The team has already derived significant value by reaching a shared, detailed understanding of what needs to be delivered. They can build on that by formulating that understanding as a business-readable specification, providing a feedback loop that ensures misunderstandings don’t creep in as the product evolves.</p>
<p>It’s during <a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">Formulation</a> that the domain language becomes a powerful communication tool. This takes time and effort, but without rigorous definitions of terms being used, both common (e.g., account, customer, date) and domain specific, defects and regressions are inevitable.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="automation">Automation<a href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove#automation" class="hash-link" aria-label="Direct link to Automation" title="Direct link to Automation" translate="no">​</a></h3>
<p>The incremental value of Formulation is multiplied when the specification is automated, delivering four significant benefits.</p>
<p>When the next increment of the specification is automated <strong>before</strong> the relevant production code is written, it can be used by the development team to guide development. As soon as the automation demonstrates that the product behaves as described in the specification, the development team knows that they have delivered what is required. No more and no less.</p>
<p>The automated specification can be used in the organisation’s continuous integration and delivery (CI/CD) pipeline as part of its regression testing strategy. This can significantly reduce the cost of creating and maintaining automated tests.</p>
<p>At this point, the automated specification becomes reliable, authoritative <a href="https://www.pearson.com/us/higher-education/program/Martraire-Living-Documentation-Continuous-Knowledge-Sharing-by-Design/PGM1724668.html" target="_blank" rel="noopener noreferrer" class="">living documentation</a>. Every time the CI/CD pipeline runs the product will be validated against the specification, giving a high level of confidence that the documentation is accurate. This is valuable immediately but becomes even more valuable as the product matures and the teams that maintain it grow and change.</p>
<p>Because the living documentation is business-readable, this gives businesspeople a transparent view of product development status that would normally require the provided by people from the delivery team. As the functionality of the product grows, the relevant sections of the specifications will appear in the documentation, complete with evidence that the behaviour they describe has verifiably been implemented.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>The original question asks whether the benefits justify the extra work. I hope I have shown that the benefits are significant, but I disagree with the initial assertion that it requires extra work. Instead, I believe that this approach simply makes the necessary work visible.</p>
<p>By encouraging teams to collaboratively learn the details of a feature before writing code or tests, there are reduced misunderstandings, fewer defects, and less context switching. This learning has to happen for the team to be able to deliver the software, but by learning early we reduce the waste of unnecessary rework.</p>
<p>Formulation and Automation take this learning and turn it into an artefact that improves communication, guides developers to only create code that is necessary, contributes to automated testing, and delivers documentation that can be relied on for as long as the product is in use. The value of reliable documentation on its own is hard to overestimate.</p>
<p>The value described in this post derives from adopting a behaviour-driven approach to software development. Using SpecFlow or Cucumber as automation tools without first engaging in Discovery and Formulation will not deliver the same benefits.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="going-deeper">Going deeper<a href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove#going-deeper" class="hash-link" aria-label="Direct link to Going deeper" title="Direct link to Going deeper" translate="no">​</a></h2>
<ul>
<li class="">Gáspár Nagy and I have written_ <a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">books about Discovery and Formulation</a>.</li>
<li class="">Matt Wynne will be presenting a webinar called "The Engineering Manager's Dilemma" on April 28th, 2021 (<a href="https://smartbear.com/resources/webinars/the-engineering-managers-dilemma/" target="_blank" rel="noopener noreferrer" class="">registration needed</a>)</li>
<li class="">Aslak Hellesøy has described techniques for making <a href="https://www.youtube.com/watch?v=PE_1nh0DdbY" target="_blank" rel="noopener noreferrer" class="">functional acceptance tests run in milliseconds</a> (often reducing dependencies on frameworks like Selenium).</li>
</ul>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Why should automation be done by the dev team?]]></title>
        <id>https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team</id>
        <link href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team"/>
        <updated>2021-03-17T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[I’ve been writing and talking about test automation and BDD for quite a while now. In February 2021 I gave a short version of a talk called “Are BDD and test automation the same thing?” at the Automation Guild conference to explore their relationship and address the confusion that exists in the industry.]]></summary>
        <content type="html"><![CDATA[<p>I’ve been writing and talking about test automation and BDD for quite a while now. In February 2021 I gave a short version of a talk called <a href="https://www.slideshare.net/sebrose/are-bdd-and-test-automation-the-same-thing-automation-guild-2021" target="_blank" rel="noopener noreferrer" class="">“Are BDD and test automation the same thing?”</a> at the <a href="https://guildconferences.com/ag-2021/" target="_blank" rel="noopener noreferrer" class="">Automation Guild conference</a> to explore their relationship and address the confusion that exists in the industry.</p>
<p>The conference organiser, Joe Colantonio, hosted a Q&amp;A session after the talk, but there wasn’t enough time to answer all of the questions. Handily, he provided me with a list of all the questions asked, along with his estimation of their “sentiment” – either neutral or negative. In this series of posts, I am going to address the five unanswered questions that he marked as having a negative sentiment.</p>
<ul>
<li class="">Why should automation be done by the dev team?</li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/isn-t-the-business-readable-documentation-just-ove/">Isn’t the business-readable documentation just extra overhead?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/what-s-wrong-with-changing-the-scenarios-to-enabl/">What’s wrong with changing the scenarios to enable automation?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/can-all-testing-be-automated/">Can all testing be automated?</a></li>
<li class=""><a class="" href="https://cucumber.io/blog/bdd/how-can-cucumber-help-us-understand-the-root-cause/">How can Cucumber help us understand the root causes of failure?</a></li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-question">The question<a href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team#the-question" class="hash-link" aria-label="Direct link to The question" title="Direct link to The question" translate="no">​</a></h2>
<blockquote>
<p>I do not get, why you say the automation part #5 on the graph, should be done by the dev team and never the QA, because it's part of the design process. For example, if a team uses Serenity-BDD with screenplay, which makes it very easy to implement SBEs, shouldn't dev team focus on prod code instead?</p>
</blockquote>
<p>The question relates to this diagram (which was published in <a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">Discovery</a> and as a <a href="https://www.linkedin.com/pulse/bdd-tasks-activities-seb-rose/" target="_blank" rel="noopener noreferrer" class="">LinkedIn article</a>).</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/ebf9bb6300693b7ea20afef95510d77aa935c60c3efdd4fcbc77377fd0ff7a05-99f514e4fd74b5095b2dc1c26b9c7c7e.png" width="451" height="298" class="img_ev3q"></p>
<p>In my talk I made it clear that I believed that developers should be involved in step <strong>#5 -</strong> <strong>Automate</strong>. The questioner asks <em>“…</em> <em>shouldn't DEV team focus on prod code …?”</em> This is a very common question, rooted in a confusion between BDD and Test Automation.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="test-automation">Test automation<a href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team#test-automation" class="hash-link" aria-label="Direct link to Test automation" title="Direct link to Test automation" translate="no">​</a></h2>
<p>Test automation is a generic term that can be applied to any activity that results in the automation of tests. Programmer (or unit) tests are one aspect of test automation. So are integration tests and end-to-end (E2E) tests. Load, performance, and penetration tests can also be automated.</p>
<p>Typically, teams that are focused on test automation do that automation <strong><em>after</em></strong> the code has been written. Development and testing are separate activities, often undertaken by different teams with different goals.</p>
<p>Development goal: implement the feature</p>
<p>Testing goal: check the implementation achieves expected quality</p>
<p>This approach is widespread and valuable but has some drawbacks. If you’d like to dig into those drawbacks there are some links in the <a href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team#_Ref66891642" class=""><strong><em>Going deeper</em></strong></a> section below.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="bdd">BDD<a href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team#bdd" class="hash-link" aria-label="Direct link to BDD" title="Direct link to BDD" translate="no">​</a></h2>
<p>Behaviour-driven development (BDD) is an approach that grew out of test-driven development (TDD) and agile software development. <a class="" href="https://cucumber.io/docs/bdd/">The goals of BDD</a> are:</p>
<ul>
<li class="">Encouraging collaboration across roles to build shared understanding of the problem to be solved</li>
<li class="">Working in rapid, small iterations to increase feedback and the flow of value</li>
<li class="">Producing system documentation that is automatically checked against the system’s behaviour</li>
</ul>
<p>The diagram at the beginning of this article lays out and <em>idealised</em> behaviour-driven process flow. As you can see, step <strong>#5 – Automate</strong> comes before <strong>#6 – Implement</strong>, which can seem back-to-front from some perspectives. How can we automate the testing of software that doesn’t exist yet?</p>
<p>Take a minute to change perspective and things don’t seem quite so crazy. The Automate step isn’t about testing at all. Each scenario describes one behaviour of the system which will need be implemented in code. When we automate that scenario, we begin to <strong><em>imagine the code we wish we had</em></strong>. This is a detailed design activity – and as such needs the involvement of someone with development skills.</p>
<p>This approach is, in this respect, identical to TDD – except that TDD is generally a developer-only activity. BDD is collaborative, bringing together the 3 Amigos (business, developer, tester) to collaborate throughout. The additional benefits that BDD brings are a shared understanding of the business domain and business-readable documentation.</p>
<p><strong>#5 – Automate</strong> transforms a scenario in the business-readable documentation into a failing automated test. This guides the development team as they design and implement the code that will deliver the specified functionality. Once the behaviour has been implemented, the automation ensures the continued correctness of the system’s behaviour, and the documentation is considered <strong><em>living</em></strong> documentation. In contrast, documentation that lives in textual documents that are external to the system itself, can be thought of as <strong><em>dead</em></strong> documentation, because it usually reflects how the system <em><strong>used to behave</strong></em>.</p>
<p>BDD does not replace traditional testing and test automation, but it does reduce a team’s reliance on them to some degree. Nor does BDD replace a team’s need for people with testing skills. They are needed more than ever – to help the team reach a shared understanding, to share with developers their specialised domain knowledge, and to ensure customer satisfaction using specific skills such as exploratory, load, or usability testing.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="confusion">Confusion<a href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team#confusion" class="hash-link" aria-label="Direct link to Confusion" title="Direct link to Confusion" translate="no">​</a></h2>
<p>The confusion between test automation and BDD may have its roots in its predecessor, TDD. It has always been problematic that a design and development technique should have the word “test” so prominent in its name. Especially in an industry where development and test have been so siloed for so long.</p>
<p>The confusion has been exacerbated by the understandable desire to utilise testers that don’t have development skills to write automated tests. This desire has been encouraged by the existence of natural language automation formats using the language of Given/When/Then:</p>
<ul>
<li class="">Given/When/Then are the core keywords of Gherkin</li>
<li class="">Gherkin is the structured syntax understood by automation tools such as Cucumber</li>
<li class="">Cucumber is a widely downloaded, open-source tool, available on numerous platforms</li>
<li class="">Cucumber was created to support BDD</li>
</ul>
<p>These facts allow people to deduce an “obvious” but incorrect conclusion:</p>
<ul>
<li class="">I conform to Gherkin when I write my tests</li>
<li class="">I use Cucumber to automate my Gherkin</li>
<li class="">Cucumber was created to support BDD</li>
<li class="">Therefore, I am "doing BDD"</li>
</ul>
<p>The correct conclusion should be:</p>
<ul>
<li class="">Therefore, I am automating tests using Given/When/Then</li>
</ul>
<p>The correct logic flows in the opposite direction:</p>
<ul>
<li class="">To benefit from a shared understanding, the team needs to collaborate on the detailed specifications</li>
<li class="">To assure the value of that understanding, it must be captured using business-readable terms</li>
<li class="">Gherkin’s use of natural language and Given/When/Then makes it an ideal choice</li>
<li class="">Cucumber’s ability to understand Gherkin makes it the ideal automation tool</li>
<li class="">Therefore, Cucumber and Gherkin are supporting the team to work in a behaviour-driven way</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>If the goal is to automate a test, then you may not need developer skills (I think you still need developer skills, but that is another article).</p>
<p>If the goal is to reduce misunderstandings (and hence defects, rework, and costs), then you should look beyond test-after automation to BDD. In which case functional automation is an integral part of the design and implementation process and requires the development team to be leading participants.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="going-deeper">Going deeper<a href="https://cucumber.io/blog/bdd/why-should-automation-be-done-by-the-dev-team#going-deeper" class="hash-link" aria-label="Direct link to Going deeper" title="Direct link to Going deeper" translate="no">​</a></h2>
<p>I’ve presented a session called “Contrasting test automation and BDD” on this topic at a number of conferences and webinars over the past year. For more extensive coverage, please <a href="https://www.dropbox.com/s/pxsj5tyllxkz67a/Test%20automation%20%26%20BDD%20-%20Vivit%20Unicom%202020.mp4?dl=0" target="_blank" rel="noopener noreferrer" class="">watch the video</a> and take a look at the <a href="https://www.slideshare.net/sebrose/test-automation-and-bdd-vivit-unicom-2020" target="_blank" rel="noopener noreferrer" class="">slides</a>.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Gherkin Rules]]></title>
        <id>https://cucumber.io/blog/bdd/gherkin-rules</id>
        <link href="https://cucumber.io/blog/bdd/gherkin-rules"/>
        <updated>2021-03-15T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Gojko Adzic wrote his award-winning book, Specification By Example, 11 years ago. Last year, he ran an online poll to determine the most popular format for expressing examples and found that Given/When/Then received 71% of the votes.]]></summary>
        <content type="html"><![CDATA[<p>Gojko Adzic wrote his award-winning book, <a href="https://www.amazon.co.uk/Specification-Example-Successful-Deliver-Software/dp/1617290084" target="_blank" rel="noopener noreferrer" class="">Specification By Example</a>, 11 years ago. Last year, he ran an <a href="https://gojko.net/2020/03/17/sbe-10-years.html" target="_blank" rel="noopener noreferrer" class="">online poll</a> to determine the most popular format for expressing examples and found that Given/When/Then received 71% of the votes.</p>
<p>Gherkin is probably the reason for this win, because:</p>
<ul>
<li class="">Given/When/Then are the core keywords of Gherkin</li>
<li class="">Gherkin is the structured syntax understood by automation tools such as Cucumber</li>
<li class="">Cucumber is a widely downloaded, open-source tool, available on numerous platforms</li>
</ul>
<p>So, it might be fair to say that when it comes to documenting and automating examples, “Gherkin rules.” That is not what this article is about.</p>
<p>Gherkin had been incredibly stable for almost a decade, but in late 2018 a new keyword was introduced: Rule. I’m going to explain the background to that change and bring you up to date with a recent fix that makes the Rule keyword consistent with other Gherkin keywords.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="example-mapping">Example Mapping<a href="https://cucumber.io/blog/bdd/gherkin-rules#example-mapping" class="hash-link" aria-label="Direct link to Example Mapping" title="Direct link to Example Mapping" translate="no">​</a></h2>
<p>Matt Wynne discovered example mapping while helping a client’s team. They were struggling to analyse the details of a user story and Matt used a deck of coloured index cards to help teach them a structured way of reaching a shared understanding of what behaviour the story should deliver.</p>
<p>If you’re not familiar with example mapping, then I suggest you spend a few minutes reading Matt’s excellent introductory article, <a class="" href="https://cucumber.io/blog/bdd/example-mapping-introduction/">Introducing Example Mapping</a>. For the purposes of this article, the salient point is that example mapping concerns itself with four concepts, each represented by a coloured card: Story (yellow), Rule (blue), Example (green), and Question (red).</p>
<p>Once example mapping is complete, you should have a structure that looks something like this:</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/seb-rose-gherkin-rules-examples-mapped-8a7935eee54731a10298798e7383a5c1.png" width="688" height="650" class="img_ev3q"></p>
<p>You can tell that the story is well understood, because there are no red question cards in the map. All of the team’s questions have been answered satisfactorily.</p>
<p>For the story to be considered <em>done</em>, the team will need to deliver code that implements each of the rules, laid out horizontally underneath the story. To dispel any ambiguity, each rule is illustrated by examples, laid out vertically beneath it.</p>
<p>The <a href="https://www.linkedin.com/pulse/bdd-tasks-activities-seb-rose/" target="_blank" rel="noopener noreferrer" class="">next step is to <em>formulate</em> the examples</a> – translating each example into a business-readable, natural language <em>Scenario</em> that can be automated by Cucumber.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="formulation">Formulation<a href="https://cucumber.io/blog/bdd/gherkin-rules#formulation" class="hash-link" aria-label="Direct link to Formulation" title="Direct link to Formulation" translate="no">​</a></h2>
<p>Gherkin scenarios are written in <em>feature</em> files. Each feature file describes some capability of the system being developed. The example map also describes some capability of the system being developed. Formulation is the process of documenting the shared understanding reached during example mapping in a business-readable format (for current and future teams) that can also be understood by automation tools.</p>
<p>Of the four card types used in example mapping, only two of them should be captured in feature files – the rules and the examples.</p>
<p>The story card should not be reflected in a feature file, because a user story is a transient artefact of prioritisation and planning. <a class="" href="https://cucumber.io/blog/bdd/user-stories-are-not-the-same-as-features/">I’ve talked about this at length</a>.</p>
<p>Question cards should not be reflected in a feature file, because they should be answered before the example map is formulated as scenarios. The answers to the question cards may well have caused the creation of rules and/or examples which need to be documented in the feature file, but the questions themselves are transient.</p>
<p>Each scenario in a feature file represents a single example card from the example map. We’ve had a lot of experience with successful formulation of examples as scenarios, but this is out of scope for this article. If you want to know more, we’ve written a short book about the subject called <a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">Formulation</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="gherkin-before-rule">Gherkin before Rule<a href="https://cucumber.io/blog/bdd/gherkin-rules#gherkin-before-rule" class="hash-link" aria-label="Direct link to Gherkin before Rule" title="Direct link to Gherkin before Rule" translate="no">​</a></h2>
<p>Each example in an example map illustrates one (and only one) rule. The relationship between rule and example is critical. Without its examples, a rule may be ambiguous. Without a rule, an example lacks context. Together they fully specify an expected behaviour of the product and guide the development team’s efforts.</p>
<p>You would therefore expect Gherkin to provide a mechanism for documenting the rule that each scenario illustrates, but until Gherkin 6 this was not possible. The root cause is that Matt discovered example mapping <strong><em>after</em></strong> BDD, Cucumber, and Gherkin were created.</p>
<p>For over five years, the recommendation was to record the rules illustrated in a feature file as part of the <a class="" href="https://cucumber.io/docs/gherkin/reference/#feature">feature file description</a> – a free text portion following the feature’s name.</p>
<div class="language-gherkin codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#0f172a;--prism-background-color:var(--ifm-hero-background-color)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-gherkin codeBlock_bY9V thin-scrollbar" style="color:#0f172a;background-color:var(--ifm-hero-background-color)"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#0f172a"><span class="token feature keyword" style="color:#0c4a6e">Feature:</span><span class="token feature important"> Library changes</span><span class="token feature"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token feature"></span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  Rules implemented:</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  - Members pay reservation of $1 per item</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  - Maximum of 2 active reservations per member</span><br></span></code></pre></div></div>
<p>The problem with this approach is that most feature files document several rules and there is no way to associate each scenario in the feature file with the feature file description that lists the rule that it was created to illustrate.</p>
<p>An alternative is to add a comment to each scenario, referencing the rule that it illustrates by name.</p>
<div class="language-gherkin codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#0f172a;--prism-background-color:var(--ifm-hero-background-color)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-gherkin codeBlock_bY9V thin-scrollbar" style="color:#0f172a;background-color:var(--ifm-hero-background-color)"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#0f172a"><span class="token feature keyword" style="color:#0c4a6e">Feature:</span><span class="token feature important"> Library changes</span><span class="token feature"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token feature"></span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><span class="token scenario keyword" style="color:#0c4a6e">Scenario:</span><span class="token scenario important"> Reserving a single book</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Given</span><span class="token plain"> Andrew is a member</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">When</span><span class="token plain"> he reserves one book</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Then</span><span class="token plain"> he is charged $1.00</span><br></span></code></pre></div></div>
<p>While this does document the association, these comments are no different from any other comment as far as IDEs or automation tools are concerned, so the important relationship is only visible after a careful reading of the text.</p>
<p>With the creation of a Rule keyword in 2018 the relationship between rule and scenario became a first-class concern of Gherkin.</p>
<div class="language-gherkin codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#0f172a;--prism-background-color:var(--ifm-hero-background-color)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-gherkin codeBlock_bY9V thin-scrollbar" style="color:#0f172a;background-color:var(--ifm-hero-background-color)"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#0f172a"><span class="token feature keyword" style="color:#0c4a6e">Feature:</span><span class="token feature important"> Library changes</span><span class="token feature"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token feature"></span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  Rule: Members pay reservation of $1 per item</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token scenario keyword" style="color:#0c4a6e">Scenario:</span><span class="token scenario important"> Reserving a single book</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">      </span><span class="token atrule">Given</span><span class="token plain"> Andrew is a member</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">      </span><span class="token atrule">When</span><span class="token plain"> he reserves one book</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">      </span><span class="token atrule">Then</span><span class="token plain"> he is charged $1.00</span><br></span></code></pre></div></div>
<p>Modern IDEs are able to display scenarios grouped by rule – and results of automation are grouped by rule as well. The critical relationship of rule and example that forms the foundation of example mapping can now be truthfully represented in a Gherkin feature file.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="inconsistent-tagging">Inconsistent tagging<a href="https://cucumber.io/blog/bdd/gherkin-rules#inconsistent-tagging" class="hash-link" aria-label="Direct link to Inconsistent tagging" title="Direct link to Inconsistent tagging" translate="no">​</a></h2>
<p>In the effort to add the Rule keyword to Gherkin, an important piece of functionality was overlooked. Gherkin supports the ability to <em>tag</em> features and scenarios with domain-specific text. The tags can be used for many purposes, including the <a class="" href="https://cucumber.io/docs/cucumber/api/#tags">creation of documentation subsets and the selective invocation of automation code</a>.</p>
<p>Each Gherkin scenario can have a distinct set of tags applied to it, but all scenarios in a feature file also inherit any tags applied at the feature file level. Since scenarios notionally illustrate a rule, it would make sense for them to inherit any tags applied at the rule level as well.</p>
<p>Unfortunately, the original implementation of the Rule keyword did not allow tags to be added at the Rule level.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="consistency-is-coming">Consistency is coming<a href="https://cucumber.io/blog/bdd/gherkin-rules#consistency-is-coming" class="hash-link" aria-label="Direct link to Consistency is coming" title="Direct link to Consistency is coming" translate="no">​</a></h3>
<p>Last week, a <a href="https://github.com/cucumber/cucumber/pull/1356" target="_blank" rel="noopener noreferrer" class="">pull request enabling the tagging of Rules</a> was merged into the Gherkin project. Tag inheritance was also implemented and behaves in exactly the same way as feature tag inheritance. A scenario will inherit any tags applied to the rule that it illustrates, as well as any tags applied to the feature.</p>
<div class="language-gherkin codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#0f172a;--prism-background-color:var(--ifm-hero-background-color)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-gherkin codeBlock_bY9V thin-scrollbar" style="color:#0f172a;background-color:var(--ifm-hero-background-color)"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#0f172a"><span class="token tag" style="color:#0ea5e9">@my_feature_tag</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain"></span><span class="token feature keyword" style="color:#0c4a6e">Feature:</span><span class="token feature important"> Library changes</span><span class="token feature"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token feature"></span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><span class="token tag" style="color:#0ea5e9">@my_rule_tag</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  Rule: Members pay reservation of $1 per item</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token tag" style="color:#0ea5e9">@my_scenario_tag</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token scenario keyword" style="color:#0c4a6e">Scenario:</span><span class="token scenario important"> Reserving a single book</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token comment" style="color:#6A9955"># this scenario has all three tags applied </span><br></span></code></pre></div></div>
<p>This change will automatically be incorporated into future releases of flavours of Cucumber managed by the <a href="https://github.com/cucumber" target="_blank" rel="noopener noreferrer" class="">Cucumber open-source project</a> – as well as any ports of Cucumber that use Cucumber’s Gherkin parser.</p>
<p>Over the coming months, expect to see Rule tagging ship with your Gherkin automation tool of choice. Finally, the <em>Discovery</em> practice of example mapping, and the world’s favourite <em>Formulation</em> format will be consistent with each other.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="Gherkin" term="Gherkin"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Solving: "How to organise feature files?"]]></title>
        <id>https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files</id>
        <link href="https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files"/>
        <updated>2021-01-08T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Over the holidays you voted for different ways to organise feature files. This article shows the results of the survey, an analysis of the votes, and some general ideas on how to organise your living documentation.]]></summary>
        <content type="html"><![CDATA[<p>Over the holidays you voted for <a href="https://specflow.org/blog/how-to-organise-feature-files-givenwhenthenwithstyle/" target="_blank" rel="noopener noreferrer" class="">different ways to organise feature files</a>. This article shows the results of the survey, an analysis of the votes, and some general ideas on how to organise your living documentation.</p>
<p><a href="https://gojko.net/" target="_blank" rel="noopener noreferrer" class="">Gojko Adzic</a> has been running a series of challenges called <a href="https://twitter.com/search?q=%23GivenWhenThenWithStyle&amp;src=typed_query&amp;f=live" target="_blank" rel="noopener noreferrer" class="">#GivenWhenThenWithStyle</a>. This is my solution to challenge #16. You should definitely check out the <a href="https://specflow.org/blog/the-given-when-then-with-style-challenge/" target="_blank" rel="noopener noreferrer" class="">rest of the challenges and their solutions</a>.</p>
<p><a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">Gáspár Nagy and I have written in more detail about writing and organising feature files in our new book, <em>Formulation</em></a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-winner-is">The winner is…<a href="https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files#the-winner-is" class="hash-link" aria-label="Direct link to The winner is…" title="Direct link to The winner is…" translate="no">​</a></h2>
<p>From the survey, <em>splitting by functional area and grouping by capability</em> was the runaway winner.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/9f84f20c6c62030558dcfed7cd33dc9c854b47016b49ba2214d7f46175fce0ee-d12afcaa43d0cc7b8740558434938326.png" width="747" height="447" class="img_ev3q"></p>
<p>Regarding the “other”, Ken Pugh again posted a <a href="https://www.blog.acceptancetestdrivendevelopment.com/organizing-your-feature-files/" target="_blank" rel="noopener noreferrer" class="">detailed response</a> in which he suggests organising feature files in a functional hierarchy. I’ll dig into this in more detail later in this post.</p>
<p>Dhanunjay was one of three participants that chose the <em>feature file per story</em> solution, for ease of maintenance. Another participant chose <em>split by system component</em> because it gave “better visibility of test coverage”. I have very strong reservations about both of these rationales, which I explain below.</p>
<p>Matt Wynne was one of the participants that selected the winning option, with this succinct reason:</p>
<blockquote>
<p>Because every one of the other options leaks solution domain; this is the only one that's pure problem domain.</p>
</blockquote>
<p>This reason was echoed by other participants André, Marcel Kwakernaak, and Geert-Jan Thomas who all recognised the importance of feature files as business-facing documentation. I particularly like this comment, left by an anonymous participant:</p>
<blockquote>
<p>The software that is developed is for business purpose, therefore ability to master business capability is prime over technical aspect. I like the idea of being able to quickly pin down system-components in question that generate issues, so a supporting structure that conveys which system-component is to "blame" is very welcome - typically I do this with tags and evaluate the test-reports based on tags…</p>
</blockquote>
<p>More on tags later.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="specification-or-testing">Specification or testing?<a href="https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files#specification-or-testing" class="hash-link" aria-label="Direct link to Specification or testing?" title="Direct link to Specification or testing?" translate="no">​</a></h2>
<p>In my experience, the Given/When/Then format has two major drivers in industry:</p>
<ul>
<li class="">Specification of system behaviour</li>
<li class="">Test automation</li>
</ul>
<p>It was originally used as a way to specify the behaviour of systems. To automatically verify that the software being developed met those specifications, the Given/When/Then examples needed to be written in a format that automation tools could understand. This led to the creation of the Gherkin language, which defined a structured way to capture Given/When/Then specifications as scenarios in feature files. Gherkin enabled the creation of automation tools (such as JBehave, Cucumber, SpecFlow) that could read the specifications and execute automation code in response.</p>
<p>With the increased demand for test automation, Gherkin’s similarity to natural language was recognised as a way to enable test automation tasks to be performed by people that did not have software development skills.</p>
<p>The winning option for this challenge implicitly assumes that Gherkin is being used to specify system behaviour. The responses expect feature files to be used as documentation, throughout the lifetime of the product. This has always been the intention of <em>Behaviour-driven development (BDD)</em> and <em>Specification by example (SbE)</em>.</p>
<p>The remainder of this solution will assume that you intend to use Gherkin to document system behaviour.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="features-are-documentation">Features are documentation<a href="https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files#features-are-documentation" class="hash-link" aria-label="Direct link to Features are documentation" title="Direct link to Features are documentation" translate="no">​</a></h2>
<p>Gherkin documentation is split into feature files, but there’s no standard definition of what a <strong><em>feature</em></strong> is. The Collins dictionary <a href="https://www.collinsdictionary.com/dictionary/english/feature" target="_blank" rel="noopener noreferrer" class="">defines a feature</a> as “an interesting or important part or characteristic,” and I don’t intend to try to be more specific.</p>
<p>To illustrate feature file organisation I’ll use diagrams below that relate to an imaginary online pizza ordering application (taken from our book, <a href="https://leanpub.com/bddbooks-formulation/" target="_blank" rel="noopener noreferrer" class="">Formulation</a><em>).</em></p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="navigating-the-documentation">Navigating the documentation<a href="https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files#navigating-the-documentation" class="hash-link" aria-label="Direct link to Navigating the documentation" title="Direct link to Navigating the documentation" translate="no">​</a></h3>
<p>There's nothing worse than trying to find a specific piece of information in poorly organized documentation, so feature files should be organised in a logical way. A typical way to structure documentation is to use chapters, sections, sub-sections and so on.</p>
<p>Each scenario documents an example of the system's behaviour. Scenarios live in feature files, which in turn live in source control, which is typically organised hierarchically. The feature files collectively document the behaviour of the system, but are only useful when people can easily navigate to the part that they are interested in. A hierarchical tree of folders provides a simple way to structure our documentation that is identical to traditional documentation.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/b797d8f4ac4059d333db9e735885bd8c6bcd08d2ff51684bbf06455a4e277e80-a635a5f21374ee4423575111d6c77c24.png" width="579" height="562" class="img_ev3q"></p>
<p><em>Figure 1 - Traditional documentation</em></p>
<p>Consider a system that allows customers to order pizzas online. A partial view of the documentation might look like this:</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/dc46e19b67257e785359e0f0e3e606a3ce29f661d633a17abadd1db89eafb791-7be9dda7b55834a69f0c99d9bb521e6d.png" width="512" height="493" class="img_ev3q"></p>
<p><em>Figure 2 – Online ordering</em></p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="zoom-inout">Zoom-in/out<a href="https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files#zoom-inout" class="hash-link" aria-label="Direct link to Zoom-in/out" title="Direct link to Zoom-in/out" translate="no">​</a></h3>
<p>A hierarchical structure also allows us to organise documentation by level of detail. The deeper the folder, the more fine-grained the behaviour described. Here's how the Customers hierarchy might actually look.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/0ad2c9aa48e556abdbd4188cf19657ba3c9ee102d9e2c53e45eb11dfe910e9f1-0b2928c08c7e608db5f5b5ee4a0c3da2.png" width="631" height="591" class="img_ev3q"></p>
<p><em>Figure 3 - Customers documentation</em></p>
<p>Even in a simple system, there are many levels of detail. Some readers will be looking for the big picture - they should not need to travel far from the root of the documentation. Others will be interested in specific details - they should be able to navigate to the relevant section easily.</p>
<p>This is similar to how we use online maps. We can get a good idea of where New York is relative to Washington without needing much detail. If we actually want to drive from one to the other, we will need to zoom in and get details about which route to take.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="specifying-shared-behaviours">Specifying shared behaviours<a href="https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files#specifying-shared-behaviours" class="hash-link" aria-label="Direct link to Specifying shared behaviours" title="Direct link to Specifying shared behaviours" translate="no">​</a></h3>
<p>You may have noticed a <em>send_email.feature</em> inside <em>email confirmation</em>. There may well be other features that send emails and we wouldn’t want to create a copy of that feature file wherever that functionality is used.</p>
<p>When we find a feature that is used by several parts of our system, we should ensure that a single feature file describes the behaviour. Then, if it needs to change, we only have to change the documentation in one place.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/16b7e56bda8f1a21d370694fc68ab882dcb2c0747dfc50dc6f50684b05b2d753-01226217d90704e3440113162193c910.png" width="604" height="460" class="img_ev3q"></p>
<p><em>Figure 4 – Extracting shared email functionality</em></p>
<p>It's easy to move shared features into a separate part of the tree, but at the moment, there's no special way to link from one feature file to another in Gherkin. For now, I recommend that you document the dependencies of a feature in the feature file description. The best information to include is the name and relative file path of the:</p>
<div class="language-gherkin codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#0f172a;--prism-background-color:var(--ifm-hero-background-color)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-gherkin codeBlock_bY9V thin-scrollbar" style="color:#0f172a;background-color:var(--ifm-hero-background-color)"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#0f172a"><span class="token feature keyword" style="color:#0c4a6e">Feature:</span><span class="token feature important"> Send unique link</span><span class="token feature"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token feature"></span><span class="token plain">  This feature is dependent on:</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  - Send Email - ../../../communication/email/send_email.feature</span><br></span></code></pre></div></div>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="targeted-documentation">Targeted documentation<a href="https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files#targeted-documentation" class="hash-link" aria-label="Direct link to Targeted documentation" title="Direct link to Targeted documentation" translate="no">​</a></h3>
<p>There is another important aspect of documentation - different consumers require different information. To keep the documentation readable, we need to ensure that sales executives don't get forced to read API documentation, while integrators may not be interested in all the details of our application.</p>
<p>Depending on your situation, you may choose to create separate hierarchies for specific stakeholders or interleave the targeted documentation throughout.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/29240c1e1a79871855db0f01c1f65972466d8c24775582549e26516896520f16-b3775fcf7c50ba2fd7e0227d403525ee.png" width="572" height="743" class="img_ev3q"></p>
<p><em>Figure 5 - Separate hierarchy</em></p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/2d3e5146ea1a97dd2d9a79a1743304e4c08b1d3e5df402d045e165e3cedb62b6-db9fe3e4b4531bbe3be96c7222629abe.png" width="587" height="852" class="img_ev3q"></p>
<p><em>Figure 6 - Interleaved</em></p>
<p>There are situations where it is impractical to represent cross-cutting interests hierarchically. In these cases what you need is something like an index that allows you to find all the relevant pieces of documentation. Gherkin has a <a class="" href="https://cucumber.io/docs/cucumber/api/#tags">feature called tags</a> that can be used for this purpose.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="stories-arent-features">Stories aren’t features<a href="https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files#stories-arent-features" class="hash-link" aria-label="Direct link to Stories aren’t features" title="Direct link to Stories aren’t features" translate="no">​</a></h2>
<p>It is common to see teams create a new feature file for each user story that they implement. I’ve <a class="" href="https://cucumber.io/blog/bdd/user-stories-are-not-the-same-as-features/">written extensively</a> about why this is a bad idea.</p>
<p>TL;DR – User stories are intended to be used to deliver small increments of functionality. If you create a feature file for each story, then you will expend unnecessary effort maintaining existing feature files. Additionally, feature files created this way will not be useful documentation, because each will only describe a thin slice of functionality.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://cucumber.io/blog/bdd/solving-how-to-organise-feature-files#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>Of the options provided in this challenge, the winner is the best choice. Personally, I would have chosen <em>Other</em>, because there is more to organising your documentation than simply <em>splitting by functional area</em>.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="Gherkin" term="Gherkin"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Specifying relative time periods in feature files]]></title>
        <id>https://cucumber.io/blog/bdd/specifying-relative-time-periods-in-feature-files</id>
        <link href="https://cucumber.io/blog/bdd/specifying-relative-time-periods-in-feature-files"/>
        <updated>2020-11-25T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Gojko Adzic is running a regular challenge called #GivenWhenThenWithStyle and last month’s topic was how to specify relative time periods. In his “solution” article, he disagreed with the majority of challenge respondents, favouring the use of a long scenario outline containing actual dates.]]></summary>
        <content type="html"><![CDATA[<p>Gojko Adzic is running a regular challenge called #GivenWhenThenWithStyle and <a href="https://specflow.org/blog/how-to-specify-relative-periods-givenwhenthenwithstyle/" target="_blank" rel="noopener noreferrer" class="">last month’s topic</a> was how to specify relative time periods. In his <a href="https://specflow.org/blog/solving-how-to-specify-relative-periods-givenwhenthenwithstyle/" target="_blank" rel="noopener noreferrer" class="">“solution” article</a>, he disagreed with the majority of challenge respondents, favouring the use of a long scenario outline containing actual dates.</p>
<p>I have a different take to Gojko, that is more in line with the community response. This article describes my approach – but you’d be advised to read Gojko’s <a href="https://specflow.org/blog/solving-how-to-specify-relative-periods-givenwhenthenwithstyle/" target="_blank" rel="noopener noreferrer" class="">original posts</a> first (and subscribe to the challenge).</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="brief--the-acronym">BRIEF – the acronym<a href="https://cucumber.io/blog/bdd/specifying-relative-time-periods-in-feature-files#brief--the-acronym" class="hash-link" aria-label="Direct link to BRIEF – the acronym" title="Direct link to BRIEF – the acronym" translate="no">​</a></h2>
<p>My colleague, Gáspár Nagy, and I created the BRIEF acronym to capture six principles that we find useful when writing scenarios. I’m going to critique Gojko’s solution using these principles.</p>
<p>We’ve written about BRIEF in the second book in our BDD series, <a href="https://leanpub.com/bddbooks-formulation" target="_blank" rel="noopener noreferrer" class="">Formulation</a>, and there's also a <a class="" href="https://cucumber.io/blog/bdd/keep-your-scenarios-brief/">blog post about it</a>. Here is a high-level summary of the acronym to help you read this article:</p>








































<table><thead><tr><th></th><th>Name</th><th>Meaning</th></tr></thead><tbody><tr><td>B</td><td>Business language</td><td>Business terminology aids cross-discipline collaboration</td></tr><tr><td>R</td><td>Real data</td><td>Using actual data helps reveal assumptions and edge cases</td></tr><tr><td>I</td><td>Intention revealing</td><td>Describe the desired outcomes, rather than the mechanism of how they are achieved</td></tr><tr><td>E</td><td>Essential</td><td>Omit any information that doesn’t directly illustrate behaviour</td></tr><tr><td>F</td><td>Focused</td><td>Each scenario should only illustrate a single rule</td></tr><tr><td></td><td>Brief</td><td>Shorter scenarios are easier to read, understand and maintain</td></tr></tbody></table>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="overall-structure">Overall structure<a href="https://cucumber.io/blog/bdd/specifying-relative-time-periods-in-feature-files#overall-structure" class="hash-link" aria-label="Direct link to Overall structure" title="Direct link to Overall structure" translate="no">​</a></h2>
<p>Gojko’s solution is a scenario outline with four example tables containing a total of 26 examples. This has a number of problems:</p>
<ul>
<li class="">
<p><strong>B</strong> – although the scenario does use business language, my instinct is that there are very few customers or product owners that would be interested enough in the detail to actually read and review it in detail. Collaboration is the purpose of using business language and this sort of scenario can easily put people off.</p>
</li>
<li class="">
<p><strong>F</strong> – the rule that this scenario is trying to illustrate, as stated in the original post, is “banks will cancel an authorisation if it has not been charged for a month.” However, the majority of the examples are trying to illustrate the meaning of “month” rather than focusing on authorisation cancellation. These are two separate rules, but this scenario is attempting to illustrate both of them.</p>
</li>
<li class="">
<p><strong>Brief</strong> – the scenario outline (when combined with the example tables) is long. Most users won’t be able to read the entire thing on a single screen, so they will need to scroll around the page or rely on their memory. Even if they have a large screen or a small font, it’s still hard to parse all this information – which is borne out by the errors that have made it into both the <strong><em>February</em></strong> example tables.<br>
The second example in <strong><em>February (non leap)</em></strong> should read:</p>
<p><code>| 27 January 2019   |  28 February 2019 | cancelled  |</code></p>
<p>The fourth example in <strong><em>February (non leap)</em></strong> should read:</p>
<p><code>| 28 January 2019   |  28 February 2019 | authorised |</code></p>
<p>The ninth example in <strong><em>February (leap year)</em></strong> should read:</p>
<p><code>| 29 January 2020   |  29 February 2020 | authorised |</code></p>
<p>The twelfth example in <strong><em>February (leap year)</em></strong> should read:</p>
<p><code>| 30 January 2020   |  29 February 2020 | cancelled  |</code></p>
<p>Both tables for <strong><em>February</em></strong> are also missing any examples for authorisation dates of 31 January.</p>
</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="dates">Dates<a href="https://cucumber.io/blog/bdd/specifying-relative-time-periods-in-feature-files#dates" class="hash-link" aria-label="Direct link to Dates" title="Direct link to Dates" translate="no">​</a></h2>
<p>Using actual dates does appear to follow the <strong><em>real data</em></strong> principle, but is all that information actually relevant to the rule?</p>
<ul>
<li class=""><strong>E</strong> – the only reason that the year is used in the examples is to determine whether it’s a leap year or not. It’s entirely unnecessary for the first two example tables. For the last two example tables, it’s only used to indicate whether it’s a leap year or not, so showing the actual year is unnecessary. Having extra information frequently leads to confusion, when a reader has to decide whether it’s significant or not.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-is-meant-by-match">What is meant by “match”?<a href="https://cucumber.io/blog/bdd/specifying-relative-time-periods-in-feature-files#what-is-meant-by-match" class="hash-link" aria-label="Direct link to What is meant by “match”?" title="Direct link to What is meant by “match”?" translate="no">​</a></h2>
<p>The original problem statement doesn’t use the word “match”, but it appears three times in the solution scenario outline. What does it mean? Is it explained by the comment in the <strong><em>end of month</em></strong> example table: “If matching date cannot be caculated (sic), use end of month to cancel”?</p>
<ul>
<li class=""><strong>I</strong> – the examples are trying to illustrate the <em>mechanics</em> of how a month is calculated. Having read the examples a number of times, the definition of the term “match” is not easy to understand. A cursory reading of this example table might even give a false sense of comfort.</li>
<li class=""><strong>F</strong> – there is a rule about how a month should be calculated. Trying to illustrate this rule in a scenario that is supposed to illustrate authorisation cancellation is distracting.</li>
</ul>
<p>It seems to me that the September/October examples shouldn’t even be in this example table. I presume that “matching date cannot be calculated” means that the day number of the <em>authorising</em> month is not present in the <em>processing</em> month (e.g. if authorised on 31 March there is no corresponding 31 April). However, the first example is for 30 September, and 30 October is entirely valid, so why is this example present in this table?</p>
<p>Quite apart from that, the rule itself seems inconsistent. When there is a “matching” date in the processing month, cancellation takes place the <strong>day after</strong> that date. The example for 31 March shows the authorisation being cancelled on 30 April, but it would appear more consistent to cancel the authorisation the <strong>day after</strong> the end of month i.e. 1 May. This is, of course, the decision of the product owner, but since the example is just one of many in this scenario outline it may well escape notice. As you will see in the scenarios below, this leads to some very strange inconsistencies (based upon my deduction of how the calculation is intended to take place).</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="another-solution">Another solution<a href="https://cucumber.io/blog/bdd/specifying-relative-time-periods-in-feature-files#another-solution" class="hash-link" aria-label="Direct link to Another solution" title="Direct link to Another solution" translate="no">​</a></h2>
<p>I would suggest writing a much simpler scenario to illustrate the cancellation rule. If after reviewing the calculation itself, the product owner decides to stick with this outlandish definition of a “month” then I would encourage the team to discover a domain-specific name for it!</p>
<div class="language-gherkin codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#0f172a;--prism-background-color:var(--ifm-hero-background-color)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-gherkin codeBlock_bY9V thin-scrollbar" style="color:#0f172a;background-color:var(--ifm-hero-background-color)"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><span class="token scenario keyword" style="color:#0c4a6e">Scenario Outline:</span><span class="token scenario important"> cancelling uncharged authorisations</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">   </span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  To avoid locking up client funds indefinitely, we need to cancel an authorisation if it has not been charged for a month. The accuracy level of 1 day is enough.</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">   </span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Given</span><span class="token plain"> </span><span class="token atrule">a</span><span class="token plain"> transaction is authorised</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">And</span><span class="token plain"> the transaction was not charged</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">When</span><span class="token plain"> the cancellation job runs </span><span class="token outline variable" style="color:#0c4a6e">&lt;processing period&gt;</span><span class="token plain"> later</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Then</span><span class="token plain"> the authorisation should be </span><span class="token outline variable" style="color:#0c4a6e">&lt;status&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">   </span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token scenario keyword" style="color:#0c4a6e">Examples:</span><span class="token scenario important"></span><span class="token table-head"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-head">    </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> processing period </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> status     </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> authorised </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> cancelled  </span><span class="token table-body punctuation" style="color:#475569">|</span><br></span></code></pre></div></div>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="calculating-a-month">Calculating a month<a href="https://cucumber.io/blog/bdd/specifying-relative-time-periods-in-feature-files#calculating-a-month" class="hash-link" aria-label="Direct link to Calculating a month" title="Direct link to Calculating a month" translate="no">​</a></h3>
<p>The month calculation could then be illustrated as shown in the scenarios below. Certainly, this sort of analysis should be provided to challenge the product owner’s definition of a “month”, but whether Given/When/Then is the best way to do it is open to question. Since exhaustive scenarios like these are more like test cases than a business specification, <strong>I would not put these in the same feature file with higher level scenario</strong> <strong>above</strong>. I would either:</p>
<ul>
<li class="">Consign them to a separate feature file in a sub-folder, where they won’t distract from the narrative flow, or</li>
<li class="">“Push them down the stack” into programmer tests</li>
</ul>
<p>Notice that there is no mention of authorisation, processing, or cancellation in the follwing scenarios. They simply illustrate how a month should be calculated.</p>
<div class="language-gherkin codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#0f172a;--prism-background-color:var(--ifm-hero-background-color)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-gherkin codeBlock_bY9V thin-scrollbar" style="color:#0f172a;background-color:var(--ifm-hero-background-color)"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><span class="token scenario keyword" style="color:#0c4a6e">Scenario Outline:</span><span class="token scenario important"> month calculations, not including February</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Given</span><span class="token plain"> something happened on </span><span class="token outline variable" style="color:#0c4a6e">&lt;start date&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">When</span><span class="token plain"> </span><span class="token atrule">a</span><span class="token plain"> calculation is made on </span><span class="token outline variable" style="color:#0c4a6e">&lt;calc date&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Then</span><span class="token plain"> the resulting period should be </span><span class="token outline variable" style="color:#0c4a6e">&lt;period&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token scenario keyword" style="color:#0c4a6e">Examples:</span><span class="token scenario important"> start and calculation month both have 31 days</span><span class="token table-head"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-head">    </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> start date </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> calc date   </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> period            </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 July    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 August   </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 July    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 1 September </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"> </span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token scenario keyword" style="color:#0c4a6e">Examples:</span><span class="token scenario important"> start month has 30 days and calculation month has 31 days</span><span class="token table-head"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-head">    </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> start date </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> calc date </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> period            </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 April   </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 May    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 April   </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 May    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token scenario keyword" style="color:#0c4a6e">Examples:</span><span class="token scenario important"> start month has 31 days and calculation month has 30 days</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    This leads to CRAZY inconsistencies! </span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    Have I misunderstood the matching calculation?</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain"></span><span class="token table-head"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-head">    </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> start date </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> calc date   </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> period            </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 October </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 November </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 October </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 1 December  </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 October </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 November </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 October </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 November </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">  </span><span class="token scenario keyword" style="color:#0c4a6e">Scenario Outline:</span><span class="token scenario important"> month calculation for February</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Given</span><span class="token plain"> this is a </span><span class="token outline variable" style="color:#0c4a6e">&lt;year type&gt;</span><span class="token plain"> year</span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">And</span><span class="token plain"> something happened on </span><span class="token outline variable" style="color:#0c4a6e">&lt;start date&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">When</span><span class="token plain"> </span><span class="token atrule">a</span><span class="token plain"> calculation is made on </span><span class="token outline variable" style="color:#0c4a6e">&lt;calc date&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token atrule">Then</span><span class="token plain"> the resulting period should be </span><span class="token outline variable" style="color:#0c4a6e">&lt;period&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token scenario keyword" style="color:#0c4a6e">Examples:</span><span class="token scenario important"> normal year</span><span class="token table-head"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-head">    </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> start date </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> calc date   </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> year type </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> period            </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> normal    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> normal    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> normal    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> normal    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> **a month**           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> normal    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> normal    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> normal    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> normal    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> normal    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> normal    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token plain"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token plain">    </span><span class="token scenario keyword" style="color:#0c4a6e">Examples:</span><span class="token scenario important"> leap year</span><span class="token table-head"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-head">    </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> start date </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> calc date   </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> year type </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-head th variable" style="color:#0c4a6e"> period            </span><span class="token table-head punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> **a month**           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 30 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 27 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 28 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month           </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body"></span><br></span><span class="token-line" style="color:#0f172a"><span class="token table-body">    </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 31 January </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> 29 February </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> leap      </span><span class="token table-body punctuation" style="color:#475569">|</span><span class="token table-body td string" style="color:#64748b"> a month and a day </span><span class="token table-body punctuation" style="color:#475569">|</span><br></span></code></pre></div></div>
<p>The periods <strong>underlined</strong> above are based upon my reverse-engineering of the “matching” rule and so are possibly incorrect. The first directly contradicts the example provided in Gojko’s solution. The second isn’t present in Gojko’s solution, but (by inference) I believe it would have contradicted Gojko's solution. Such is life.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://cucumber.io/blog/bdd/specifying-relative-time-periods-in-feature-files#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>I have been enjoying the #GivenWhenThenWithStyle series and find it vary valuable. Hopefully I’ve laid out my differences of opinion with Gojko in an intelligible and constructive way.</p>
<p>Gojko is one of the most influential practitioners in the field and his book <strong><em>Bridging the communication gap</em></strong> is what got me interested in this approach in the first place. It was his encouragement at a conference workshop a few years ago that led me to create the BRIEF acronym.</p>
<p>I look forward to our next meeting, COVID permitting, somewhere on the conference circuit. Or, possibly, at a vegan restaurant.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="Gherkin" term="Gherkin"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How does BDD affect traceability?]]></title>
        <id>https://cucumber.io/blog/bdd/how-does-bdd-affect-traceability</id>
        <link href="https://cucumber.io/blog/bdd/how-does-bdd-affect-traceability"/>
        <updated>2020-09-24T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Recently my colleague, Theo England, broadcast a question:]]></summary>
        <content type="html"><![CDATA[<p>Recently my colleague, Theo England, <a href="https://twitter.com/cucumberbdd/status/1276148043478372357?s=20" target="_blank" rel="noopener noreferrer" class="">broadcast a question</a>:</p>
<blockquote>
<p>We're thinking about running a … one-day class [about BDD] designed for business execs. Tell us the questions we must answer for it to be useful.</p>
</blockquote>
<p>We received 60 responses, including some very good questions.</p>
<p>As well as providing valuable input into the design of our upcoming course, <em>BDD for busy people</em>, we felt that we should answer some of the questions in a public forum. This is the second in the series.</p>
<p><strong>“Where does the sign-off of requirements happen – and how is it documented? Can we have full traceability?”</strong></p>
<p>Traceability is a big deal. In regulated industries it’s a legal necessity to demonstrate that you have followed the approved process, but it’s important in unregulated businesses as well. If you can prove to yourself that a bug-fix your team has just made fixed the intended defect (and hasn’t inadvertently broken any other functionality), then you will have the confidence to release it. Traceability from the original bug report, to the automated test(s) that initially demonstrated the defect and now demonstrate that it has been fixed, will be essential. Further evidence that relevant regression tests (automated or manual) continue to pass will also be needed. The change may need to be signed-off for compliance or process reasons.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="bdd-isnt-a-methodology">BDD isn’t a methodology<a href="https://cucumber.io/blog/bdd/how-does-bdd-affect-traceability#bdd-isnt-a-methodology" class="hash-link" aria-label="Direct link to BDD isn’t a methodology" title="Direct link to BDD isn’t a methodology" translate="no">​</a></h2>
<p><a class="" href="https://cucumber.io/docs/bdd/">Behaviour-Driven Development (BDD)</a> is a set of practices (Discovery, Formulation, Automation) that help enable teams to deliver software in an iterative and incremental way. We have seen how BDD can be a game-changer for organisations that aspire to agility (which is most of them), but we realise that there is more to delivering valuable software than the BDD practices.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/f0cc3c65859ca842c2d58cd31bd5fa40ee7f5594b4a71dd1dcbd151eb02affce-cd36fe8d82bdc575c99fd8b6fee2e601.png" width="1315" height="818" class="img_ev3q"></p>
<p>You can use BDD with any of the agile methodologies (Scrum, SAFe, XP, LeSS etc.), because BDD is about building the shared understanding that’s necessary to deliver and evolve great software products. You can use the BDD practices in any industry, on any platform, in any country, because BDD practices are agnostic about most of the specifics of your context.</p>
<p>The corollary to this is that BDD will not tell you how to implement traceability or capture sign-off. BDD is not a methodology and does not prevent you adopting your methodology of choice.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="where-do-requirements-come-from">Where do requirements come from?<a href="https://cucumber.io/blog/bdd/how-does-bdd-affect-traceability#where-do-requirements-come-from" class="hash-link" aria-label="Direct link to Where do requirements come from?" title="Direct link to Where do requirements come from?" translate="no">​</a></h2>
<p>Matt Wynne created a lovely diagram that captures software product development at a very high level.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/1e772451e48c248407ad9766df46e38286eca9c690d3146c9f7e12069e4e6d9a-9109634b7d44286c9c9863bd9bb7e2db.png" width="451" height="245" class="img_ev3q"></p>
<p>In this diagram, requirements are represented by the light bulb at the left. The requirement may have originated from a customer enhancement request, an insight from the CEO, a suggestion from an intern, or any number of other sources. How those myriad ideas are validated and prioritised is a problem not addressed by BDD.</p>
<p>The first practice of BDD, <a href="http://bddbooks.com/" target="_blank" rel="noopener noreferrer" class="">Discovery</a>, starts when the team collaboratively works together to reach a shared understanding of a requirement. During Discovery we refine, modify, and split requirements into smaller incremental work items. Any traceability or sign-off that occurs pre-Discovery will need to be revisited, because it is only during Discovery that we achieve something approaching a full understanding of the requirement.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="traceability-is-dynamic">Traceability is dynamic<a href="https://cucumber.io/blog/bdd/how-does-bdd-affect-traceability#traceability-is-dynamic" class="hash-link" aria-label="Direct link to Traceability is dynamic" title="Direct link to Traceability is dynamic" translate="no">​</a></h2>
<p>Over time requirements will change. Any approach we have that tracks the progress of requirements from inception to delivery needs to accommodate their dynamic nature. For this approach to be useful we need to be able to traverse and query the relationships to ensure, for example, that every requirement has a sponsor, or that every test has a successful execution.</p>
<p><a class="" href="https://cucumber.io/docs/installation/">Cucumber</a> provides a subset of this functionality out-of-the-box. Feature files document the requirements and Cucumber automatically verifies them against them against the software that has been delivered. All divergences between requirements and implementation are reported immediately.</p>
<p>The limitation is that BDD and Cucumber concern themselves with only a subset of the full software lifecycle, leaving pre-Discovery and post-Automation traceability as an exercise for each organisation to solve. Additionally, while the Cucumber eco-system is relatively well-served with developer tools that can navigate from feature file to code to test result, there is currently no way to easily expose these relationships in a business-friendly way.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="sign-off-is-static">Sign-off is static<a href="https://cucumber.io/blog/bdd/how-does-bdd-affect-traceability#sign-off-is-static" class="hash-link" aria-label="Direct link to Sign-off is static" title="Direct link to Sign-off is static" translate="no">​</a></h2>
<p>As the requirements change, it becomes necessary to record not just the current relationships, but also previous relationships. Since Cucumber feature files are checked into source code management (SCM) alongside the code that they document, we can use the versioning capabilities of the SCM to record snapshots of the dynamic evolution of our software systems.</p>
<p>A sign-off can be thought of as an approved snapshot that contains all relevant artefacts. We can utilise the ability to create tags or branches within the SCM as a persistent mechanism for recording that a certain version of the software has been approved. Unfortunately, SCMs typically contain only a subset of the necessary artefacts – even if managers and executives were prepared to use them for sign-off purposes.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="integration-or-monolith">Integration or monolith?<a href="https://cucumber.io/blog/bdd/how-does-bdd-affect-traceability#integration-or-monolith" class="hash-link" aria-label="Direct link to Integration or monolith?" title="Direct link to Integration or monolith?" translate="no">​</a></h2>
<p>Recording relationships as cards on a board is valuable, but difficult to search, traverse, or persist. There is very little tooling that supports this sort of relationship traceability. Some monolithic tools do exist (c.f. <a href="https://en.wikipedia.org/wiki/Rational_DOORS" target="_blank" rel="noopener noreferrer" class="">DOORS</a>), but they require the wholesale adoption of an integrated toolset.</p>
<p>Over the past decade a set of open standards has been developed, called <a href="https://open-services.net/" target="_blank" rel="noopener noreferrer" class="">Open Services for Lifecycle Collaboration (OSLC)</a>. This offers a vendor-independent approach to solving this problem by defining mechanisms that allow smaller, focussed tools to work together. Uptake has been slow.</p>
<p>Is requirements traceability something that interests you? We're looking to talk with people who have unmet traceability needs to understand what challenges they're most interested in overcoming.</p>
<p><strong>If you're willing to help us understand your requirements traceability needs</strong>,<br>
<a href="https://www.surveymonkey.com/r/9SFVNSC" target="_blank" rel="noopener noreferrer" class="">please fill out this very brief survey to participate</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://cucumber.io/blog/bdd/how-does-bdd-affect-traceability#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>BDD (and Cucumber) provide traceability within the scope of their competence – from story to test execution. Cucumber already makes this information available to business sponsors and executives through HTML reports and the newly released <a href="https://reports.cucumber.io/" target="_blank" rel="noopener noreferrer" class="">Cucumber Reports</a>. Work is ongoing to make this simpler and more wide-ranging.</p>
<p>Broader traceability that spans the full software lifecycle (outside the SCM) requires integration between multiple tools across the organisation. Expect to see tools appear in this space to ease the tensions between continuous delivery, traceability, and sign-off.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Better requirements by harnessing the power of examples]]></title>
        <id>https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa</id>
        <link href="https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa"/>
        <updated>2020-09-17T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Writing good requirements is a challenge, especially if they’re intended to be understood by someone other than their author. The more complicated a project gets, the harder it is to communicate the requirements in an unambiguous way. It’s easier to ask someone to cut the grass than it is to describe a design for a flower bed.]]></summary>
        <content type="html"><![CDATA[<p>Writing good requirements is a <a href="https://www.batimes.com/articles/elements-of-requirements-style-part-1.html" target="_blank" rel="noopener noreferrer" class="">challenge</a>, especially if they’re intended to be understood by someone other than their author. The more complicated a project gets, the harder it is to communicate the requirements in an unambiguous way. It’s easier to ask someone to cut the grass than it is to describe a design for a flower bed.</p>
<p>By the time we get to designing software systems, the complexity is such that requirements are a collaborative effort that need to be recorded in a structured way. During the 20th century, various <a href="https://www.researchgate.net/publication/340779624_The_role_of_formalism_in_system_requirements_full_version" target="_blank" rel="noopener noreferrer" class="">formal and semi-formal approaches</a> were integrated into a <a href="https://en.wikipedia.org/wiki/Waterfall_model" target="_blank" rel="noopener noreferrer" class="">waterfall model</a> – where each project had distinct, gated phases and each phase had defined outputs, such as “requirements specification”. These approaches to requirements management did not remove the risk of project failure, while adding considerable upfront costs that were often unjustified in the rapidly changing business environment.</p>
<p><a href="https://www.geograph.org.uk/photo/1096392" target="_blank" rel="noopener noreferrer" class=""><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/3e971b36ccca0e2e5e226f15fce8a76e7d3d7e39cc4b3bd494fd2628f0d069b7-b0365fbc5f8fe78f70682f5cc3c3414a.png" width="468" height="351" class="img_ev3q"></a></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-road-to-nowhere-glasgow">The Road to Nowhere, Glasgow<a href="https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa#the-road-to-nowhere-glasgow" class="hash-link" aria-label="Direct link to The Road to Nowhere, Glasgow" title="Direct link to The Road to Nowhere, Glasgow" translate="no">​</a></h2>
<p>The evolution of agile ways of delivering software <a href="https://www.glasscubes.com/agile-vs-waterfall/" target="_blank" rel="noopener noreferrer" class="">removed the phased approach</a> to defining detailed requirements in favour of incremental, just-in-time requirements definition. A side effect was a perceptible decline in enthusiasm for <a href="http://agilemanifesto.org/" target="_blank" rel="noopener noreferrer" class="">documentation</a> of any kind. Instead, <a class="" href="https://cucumber.io/blog/bdd/user-stories-are-not-the-same-as-features/">user stories were misused</a> as agile requirements, causing ambiguities that inevitably led to rework and stakeholder dissatisfaction.</p>
<p>What can we do to avoid ambiguous requirements without imposing excessive financial or time costs on our projects?</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="crosswalks">Crosswalks<a href="https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa#crosswalks" class="hash-link" aria-label="Direct link to Crosswalks" title="Direct link to Crosswalks" translate="no">​</a></h2>
<p>It is dangerous for pedestrians to cross roads, so someone came up with the idea of <a href="https://en.wikipedia.org/wiki/Pedestrian_crossing" target="_blank" rel="noopener noreferrer" class="">crosswalks</a> and signals. The goal might have been: “let’s install signals that tell pedestrians when it’s safe to cross the road.”</p>
<p>One of the user stories for a safety signal at a crosswalk might have looked like this:</p>
<p>As a pedestrian<br>
I want clear signalling at a crosswalk<br>
So that I can be safe when crossing the road</p>
<p>Attached to the card is the following acceptance criteria (AC):</p>
<ul>
<li class="">There should be separate signals for “safe to cross”, “not safe to cross”, and “safe to finish crossing, but not safe to start”</li>
</ul>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/261d78c8de577da83dc7b6c1a3636704831f481a6928266d5731746f6f919679-b3e6bb9079f4c9442608a9d15df05483.png" width="468" height="310" class="img_ev3q"></p>
<p>Take a minute to think about the goal, the user story, and the acceptance criteria. Is there any scope for misunderstanding? If so, how would you confirm your understanding of what’s being asked for and surface any ambiguity?</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="illustrating-using-concrete-examples">Illustrating using concrete examples<a href="https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa#illustrating-using-concrete-examples" class="hash-link" aria-label="Direct link to Illustrating using concrete examples" title="Direct link to Illustrating using concrete examples" translate="no">​</a></h2>
<p>Concrete examples are used in all walks of life to clarify rules. We use them when teaching our children:</p>
<p>“When you come to a cross-walk, if the signal is red, then you shouldn’t cross the road.”<br>
“When can I cross the road?”<br>
“You can cross the road if the signal is green.”<br>
“What if the red signal is flashing?”<br>
“The flashing red signal means that you shouldn’t start to cross the road. If you’re already crossing the road, then keep going, because the signal will turn to solid red soon.”</p>
<p>This conversation includes a number of examples that were used to clarify how to behave at a crosswalk:</p>
<ol>
<li class="">Arrive at a crosswalk<br>
Signal is green<br>
Cross the road</li>
<li class="">Arrive at a crosswalk<br>
Signal is solid red<br>
Don’t cross the road</li>
<li class="">Arrive at a crosswalk<br>
Signal is flashing red<br>
Don’t cross the road</li>
<li class="">Crossing the road on a crosswalk<br>
Signal starts flashing red<br>
Finish crossing the road</li>
</ol>
<p>These four concrete examples exhibit the structure that’s common to all concrete examples – they consist of three parts: context, action, and outcome:</p>
<ul>
<li class="">Context: the initial state of the system. In this case, where you are in relation to the crosswalk</li>
<li class="">Action: an input or event that causes a behaviour. In this case the state of the crosswalk signal</li>
<li class="">Outcome: the resulting intended behaviour. In this case whether to start/continue crossing or not</li>
</ul>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/ad25272f127803bb3e74548d5707d1e99337908febbe74ea3075b703c313aaea-24ba9e6155ec9276265f5d60ed80c081.png" width="468" height="143" class="img_ev3q"></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="clarifying-using-concrete-examples">Clarifying using concrete examples<a href="https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa#clarifying-using-concrete-examples" class="hash-link" aria-label="Direct link to Clarifying using concrete examples" title="Direct link to Clarifying using concrete examples" translate="no">​</a></h2>
<p>Concrete examples aren’t just useful for illustrating the intended behaviour of a system. They’re also useful for challenging and clarifying the underlying intent. Consider these examples:</p>
<ol>
<li class="">Colour-blind pedestrian arrives at a crosswalk<br>
Signal is green<br>
???</li>
<li class="">Blind pedestrian arrives at a crosswalk<br>
Signal is green<br>
???</li>
<li class="">Crossing the road on a crosswalk<br>
Signal turns solid red<br>
???</li>
</ol>
<p>The question marks in these examples indicate that the user story is insufficient to achieve the goal. In fact, crosswalk signals typically use more than just colours to indicate whether to walk or wait and many crosswalks have audible signals as well.</p>
<p>And what should you do if the signal goes solid red while you’re on the crosswalk? Stop walking? Walk faster? Panic?</p>
<p>The concreteness of an example helps us consider how a system should behave in specific situations. This engages our brain at a level of detail that doesn’t happen when we consider things in the abstract, which is why concrete examples are so powerful when it comes to clarifying requirements.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="so-many-examples">So many examples<a href="https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa#so-many-examples" class="hash-link" aria-label="Direct link to So many examples" title="Direct link to So many examples" translate="no">​</a></h2>
<p>As you can see, it’s easy to generate lots of concrete examples, but more is not necessarily better. Having too many examples can make it hard to see what’s important, as well as imposing a maintenance burden when the business needs change. There are two <a class="" href="https://cucumber.io/blog/bdd/keep-your-scenarios-brief/">common ways of managing the volume of examples</a>.</p>
<p>The first is to ensure that all examples are valuable. If two examples illustrate the same behaviour, then remove one of them. One way of demonstrating the value is by giving each example a name that explains why it exists. From the crosswalk examples, some names could be “Signal is green”, “Signal is solid red” and so on.</p>
<p>The second is to separate the examples according to the aspect of the requirement that the example illustrates. Even though all seven examples listed above illustrate the user story’s motivation of telling pedestrians when it’s safe to walk, that user story can be thought of as having several separate acceptance criteria:</p>
<ul>
<li class="">Sighted person at crosswalk should be informed if it is safe to cross</li>
<li class="">Sighted person on crosswalk should be informed that it will soon become unsafe to be on the crosswalk</li>
<li class="">Colour blind person at crosswalk should be informed if it is safe to cross</li>
<li class="">Blind person at crosswalk should be informed if it is safe to cross</li>
</ul>
<p>Acceptance criteria are a common component of user stories, but they are frequently misunderstood as test cases. Instead, you should think of acceptance criteria as rules that need to be satisfied for a user story to be considered delivered.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="spot-the-requirement">Spot the requirement<a href="https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa#spot-the-requirement" class="hash-link" aria-label="Direct link to Spot the requirement" title="Direct link to Spot the requirement" translate="no">​</a></h2>
<p>Requirement itself is an ambiguous term. The goal of telling pedestrians when it’s safe to cross the road is a requirement. The user story describes a safety requirement from the perspective of a pedestrian. The acceptance criteria also describe requirements, but at a finer granularity.</p>
<p>They are all requirements, but as we have seen, it is harder to reason about large, abstract concepts than about detailed, concrete concepts. For the remainder of this post, when I use the word “requirement”, I will be using it in a general, hand-wavy way to mean “some need that the system must satisfy”. Most of the time I will be more specific and use the following terms:</p>
<ul>
<li class="">User story: a narrative description of a need that serves as a “placeholder for a conversation”</li>
<li class="">Rule (a.k.a. acceptance criteria): a fine-grained description of a required behaviour of the system</li>
<li class="">Concrete example: a single combination of context-action-outcome that clarifies how a rule should behave</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="example-mapping">Example Mapping<a href="https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa#example-mapping" class="hash-link" aria-label="Direct link to Example Mapping" title="Direct link to Example Mapping" translate="no">​</a></h2>
<p>The Cucumber team have been using a technique called Example Mapping for almost ten years to power structured, collaborative conversations in agile teams. It was discovered by Matt Wynne and through his <a class="" href="https://cucumber.io/blog/bdd/example-mapping-introduction">blog post</a> on the subject, and many consulting engagements, it has gone on to improve requirements for countless teams across the world.</p>
<p><img decoding="async" loading="lazy" src="https://cucumber.io/assets/images/5306c10fcdc5bc0fedd43a6acc2c6758e37fc63f9390ae468b8f5f88a7118799-d404328033eff620aaf911de5687dd97.png" width="1007" height="673" class="img_ev3q"></p>
<p>I don’t propose to repeat the whole of Matt’s excellent blog post here. Instead, I’d like to summarise some of the major advantages that example mapping brings:</p>
<ul>
<li class="">Short, frequent example mapping workshops: short timespans allow people to focus; high frequency maintains momentum</li>
<li class="">Full engagement of all participants: there are cards and pens for all</li>
<li class="">Visual feedback: the example map will tell you if the story is ready to be worked on</li>
<li class="">Actionable outcomes: question cards are allocated to participants; answers will feed into the next session</li>
</ul>
<p>Originally, example mapping required teams to be collocated, with access to 4 coloured decks of index cards and buckets of Sharpies. Indeed, this may still be the most effective way of running an example mapping session, but with remote working, distributed teams, and electronic project management tools, this approach is no longer generally suitable.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="traceability">Traceability<a href="https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa#traceability" class="hash-link" aria-label="Direct link to Traceability" title="Direct link to Traceability" translate="no">​</a></h2>
<p>One property that many organisations are looking for is requirements traceability – defined as <a href="https://en.wikipedia.org/wiki/Requirements_traceability" target="_blank" rel="noopener noreferrer" class="">"the ability to describe and follow the life of a requirement in both a forwards and backwards direction (i.e. from its origins, through its development and specification, to its subsequent deployment and use, and through periods of ongoing refinement an</a><a href="https://en.wikipedia.org/wiki/Requirements_traceability" target="_blank" rel="noopener noreferrer" class="">d iteration in any of these phases)"</a></p>
<p>Simply put, traceability should be able to answer questions like:</p>
<ul>
<li class="">Has this requirement been satisfied?</li>
<li class="">What requirements does this test case verify?</li>
<li class="">Which versions of the product is this requirement available in?</li>
<li class="">What requirement(s) required this code to be written?</li>
</ul>
<p>The most typical demand for traceability comes from regulated industries, where external auditors demand evidence of compliance. However, traceability has far broader applicability than that. With the continuing shift towards continuous deployment, there’s a growing need for low overhead mechanisms that enable internal processes to automatically assess the fitness of software for release.</p>
<p>Example mapping already provides a link from user story to concrete example. Teams that are using a behaviour-driven development (BDD) approach will then formulate the concrete examples into business-readable, <a href="https://www.amazon.co.uk/Specification-Example-Successful-Deliver-Software/dp/1617290084" target="_blank" rel="noopener noreferrer" class="">executable specifications</a> that will guide development and provide long-lived, reliable, living documentation. Automated execution of the specifications extends traceability to test executions and product versions.</p>
<p>This is a significant advance when compared to the prevalent forms of requirements traceability in the industry today, such as spreadsheets or links in ALM tools. Even better, there is no overhead incurred. Every activity in the BDD approach delivers intrinsic value. Traceability comes as a secondary outcome.</p>
<p>If you're willing to help us understand your requirements traceability needs,<br>
<a href="https://www.surveymonkey.com/r/9SFVNSC" target="_blank" rel="noopener noreferrer" class="">please fill out this very brief survey to participate</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://cucumber.io/blog/bdd/better-requirements-by-harnessing-the-power-of-exa#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>The need for good requirements has existed since humankind first undertook projects that made use of more than a handful of people. Without good requirements, project outcomes are less likely to meet expectations, with negative consequences for all concerned. Manual quality processes are error-prone but do provide a level of confidence that we’re delivering what we have been asked for.</p>
<p>Modern software development organisations can no longer afford the rework that results from poor requirements, the delay that arises from manual quality processes, or the customer dissatisfaction caused by defective products. Example Mapping, automated tests, and requirements traceability combine to provide an effective solution that neither costs the earth nor taxes the brain.</p>]]></content>
        <author>
            <name>Seb Rose</name>
            <uri>https://claysnow.co.uk/</uri>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Podcast: Avoid the common pitfalls of BDD with Chris Glover]]></title>
        <id>https://cucumber.io/blog/podcast/how-to-avoid-common-pitfalls-bdd</id>
        <link href="https://cucumber.io/blog/podcast/how-to-avoid-common-pitfalls-bdd"/>
        <updated>2020-08-03T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[This month on the Cucumber Podcast, Matt Wynne and Seb Rose speak to Chris Glover, a lead test engineer who has been working in a team which has struggled with some of the common pitfalls of learning BDD. Matt invited him onto the podcast to share that story.]]></summary>
        <content type="html"><![CDATA[<p>This month on the Cucumber Podcast, Matt Wynne and Seb Rose speak to Chris Glover, a lead test engineer who has been working in a team which has struggled with some of the common pitfalls of learning BDD. Matt invited him onto the podcast to share that story.</p>
<p><iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/869321092&amp;color=%23ff5500&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;show_teaser=true"></iframe></p>]]></content>
        <author>
            <name>Theo England</name>
        </author>
        <category label="Agile" term="Agile"/>
        <category label="BDD" term="BDD"/>
        <category label="Podcasts" term="Podcasts"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[How do I scale BDD across the organization?]]></title>
        <id>https://cucumber.io/blog/how-do-i-scale-bdd-across-the-enterprise</id>
        <link href="https://cucumber.io/blog/how-do-i-scale-bdd-across-the-enterprise"/>
        <updated>2020-07-29T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[As part of our research into running our upcoming workshop, we asked what questions needed answered for this class to be useful. One question which came through was "How do I scale BDD across the enterprise?"]]></summary>
        <content type="html"><![CDATA[<p>As part of our research into running our upcoming workshop, we asked what questions needed answered for this class to be useful. One question which came through was "How do I scale BDD across the enterprise?"</p>
<p>I asked Ryan Marsh - co-author and trainer of the class to give an answer. Here's what he had to say.</p>
<p>There are three steps to scaling BDD across the organization:</p>
<ol>
<li class="">Create awareness around the problem BDD solves</li>
<li class="">Use training to create a base level of skill and soften the impact of change</li>
<li class="">Follow up and measure</li>
</ol>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="create-awareness">Create awareness<a href="https://cucumber.io/blog/how-do-i-scale-bdd-across-the-enterprise#create-awareness" class="hash-link" aria-label="Direct link to Create awareness" title="Direct link to Create awareness" translate="no">​</a></h2>
<p>BDD solves a common list of problems affecting nearly all software teams. You must make teams aware of the pain they are experiencing on a regular basis which they may have become used to.</p>
<ol>
<li class="">Lack of adequate understanding of the scope and customer needs. This leads to missed edge cases and ultimately rework, defects, failed sprints, anxiety-inducing sprint demos, and variability in team throughput.</li>
<li class="">Lack of trustworthy requirements documentation, especially as an application ages. This leads to confusion, extra labor before and after the sprint, defects, knowledge in the heads of a few, and even re-writes or reverse engineering.</li>
<li class="">Lack of customer-focused test suite. In spite of QA’s best efforts, there is often a gap in test suites. This leads to regressions, low/no information to product owners on the business impact of test failures, or even testing and work on no-value non-requirements.</li>
</ol>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="use-training">Use training<a href="https://cucumber.io/blog/how-do-i-scale-bdd-across-the-enterprise#use-training" class="hash-link" aria-label="Direct link to Use training" title="Direct link to Use training" translate="no">​</a></h2>
<p>Whole team training, such as our BDD Kickstart, can provide a shared baseline of skills on the team that will lead to success. Our training builds a whole team experience that emphasizes everyone’s role. We resolve concerns in a group setting and create excitement around the benefits of BDD.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="follow-up-and-measure">Follow up and measure<a href="https://cucumber.io/blog/how-do-i-scale-bdd-across-the-enterprise#follow-up-and-measure" class="hash-link" aria-label="Direct link to Follow up and measure" title="Direct link to Follow up and measure" translate="no">​</a></h3>
<p>As with any large initiative, it is important to follow up with teams and plot their progress along leading measures. Some teams have more challenging domains than others. This is normal and we offer tailored coaching to help those teams overcome inertia and tough challenges.</p>]]></content>
        <author>
            <name>Theo England</name>
        </author>
        <category label="BDD" term="BDD"/>
    </entry>
</feed>