{"id":10988,"date":"2019-01-28T21:33:23","date_gmt":"2019-01-28T21:33:23","guid":{"rendered":"http:\/\/abstracta.us\/blog\/?p=10988"},"modified":"2025-05-05T21:23:28","modified_gmt":"2025-05-05T21:23:28","slug":"what-is-bdd","status":"publish","type":"post","link":"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/","title":{"rendered":"What is BDD and What Does it Mean for Testers?"},"content":{"rendered":"<h1><span style=\"font-weight: 400;\">A development strategy that makes sense for both your business team and tech team<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">Behavior Driven Development (BDD), as its name indicates, is not a testing technique, but rather a development strategy (as well as TDD, which is test driven development). What it proposes is to define a common language for the business and the technical team members, using it at the outset of development and testing, hence why it\u2019s important for testers to understand BDD.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"BDD_and_TDD\"><\/span><strong><span style=\"color: #00b674;\">BDD and TDD<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">I used to think about BDD as an evolution of TDD, but then I realized that it is much more than a simple evolution. It\u2019s a different approach that solves a different problem. In TDD, the focus is on the unit test, while in BDD, the focus is testing on a higher level, functional and acceptance testing, as its aim is to <\/span><b>comply with the business and not just with the code.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Both approaches may coexist since an acceptance test could be specified and then refined into unit tests when coding that functionality in the different layers. Perhaps a clear advantage of BDD is that the developers focus on understanding the functionality and how it works at a business level.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"BDD_in_Agile_Methodologies\"><\/span><strong><span style=\"color: #00b674;\">BDD in Agile Methodologies<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">This strategy fits well in the agile methodologies since, generally, requirements are defined as user stories. These user stories must have their acceptance criteria which are used to define acceptance tests, that can be written directly in a specific language called Gherkin.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"A_Common_Language_for_Business_and_Tech_Gherkin\"><\/span><strong><span style=\"color: #00b674;\">A Common Language for Business and Tech: Gherkin<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Gherkin is a very simple language, which can be written by someone who does not have a programming background, but at the same time, it can be understood by a computer program, in order to use it as a test specification.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Typically, these tests will be stored in &#8220;.feature&#8221; files, which should be versioned together with the source code of the system being tested. Here\u2019s a <\/span><a href=\"https:\/\/github.com\/cucumber\/cucumber\/wiki\/Gherkin\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">simple example taken from Cucumber<\/span><\/a><span style=\"font-weight: 400;\">:<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-10991\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2019\/01\/feature.png\" alt=\"Gherkin in Cucumber\" width=\"800\" height=\"392\" \/><\/p>\n<p><span style=\"font-weight: 400;\">These files specify:<\/span><\/p>\n<ul>\n<li><b>Feature:<\/b><span style=\"font-weight: 400;\"> the name of the functionality to be tested, the title of the test<\/span><\/li>\n<li><b>Scenario:<\/b><span style=\"font-weight: 400;\"> one scenario for each test that you want to specify for this functionality<\/span><\/li>\n<li><b>Given: <\/b><span style=\"font-weight: 400;\">the preconditions<\/span><\/li>\n<li><b>When:<\/b><span style=\"font-weight: 400;\"> the actions that are going to be executed<\/span><\/li>\n<li><b>Then: <\/b><span style=\"font-weight: 400;\">the expected result, the validations to be made<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">We usually have one <\/span><i><span style=\"font-weight: 400;\">feature <\/span><\/i><span style=\"font-weight: 400;\">per file and it will contain different test scenarios.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Note: Gherkin supports many languages, so although the most common is to see it in English, it can be in other languages as well.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Who writes the acceptance tests?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It depends greatly on each team, but acceptance tests can be written by the Product Owner or someone else from the team, like a tester or developer. Perhaps a good option is to do it together, at least the brainstorm, as a part of the story refinement. Then, the tester could be responsible for ensuring that the acceptance tests are well written and with the proper coverage according to the defined testing strategy.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"BDD_and_Testability\"><\/span><strong><span style=\"color: #00b674;\">BDD and Testability<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">The BDD approach favors system testability. I dare to say that <\/span><b>this scheme works better with microservice architecture than with monolithic systems<\/b><span style=\"font-weight: 400;\"> because the former allows adding and working on all layers independently per feature. This scheme facilitates testing as we think about the test before any line of code, thus it provides greater testability. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">This reminds me of the Scrum Master course I took by <\/span><a href=\"https:\/\/www.peregrinus.com.uy\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">Peregrinus<\/span><\/a><span style=\"font-weight: 400;\">, where the instructor mentioned that in Agile, the important thing is to know how to \u201ccut the cake.\u201d <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Think of a multi-layered cake. Each layer adds a new flavor that is to be combined with the other layers.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If the cake is cut horizontally, some people may only get the crust, some a chocolate middle layer, another a layer of vanilla, or a mix of the two, etc. In this scenario, no one would get to taste the cake as it was fully meant to be enjoyed and no one could say they actually tasted the cake. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">The same happens with the approach of writing a user story per component. Everything can work well separately, but upon integration, thousands of potential problems can appear.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">That is why the stories are compared to a cake slice (When cut the right way, vertically!). This slice should include everything from the crust to the frosting so that you can try (&#8220;test&#8221;) everything together.<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-10992\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-28-at-4.16.45-PM-min.png\" alt=\"layered cake slice\" width=\"600\" height=\"502\" \/><\/p>\n<p style=\"text-align: center;\"><em><a href=\"https:\/\/craftlog.com\/us\/cooking\/ext-four-layer-cake-with-buttercream-M9qR\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"color: #d3d3d3;\">Image Source<\/span><\/a><\/em><\/p>\n<p><span style=\"font-weight: 400;\">That is, there shouldn\u2019t be a story like &#8220;implement XX functionality in the data access layer&#8221; because it\u2019s not business oriented. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">BDD works best facilitating and promoting having a testable system, where the cake is cut well, focusing the stories towards a business functionality and implementing it with all of its layers completed.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"BDD_for_Automating_Tests\"><\/span><strong><span style=\"color: #00b674;\">BDD for Automating Tests<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">The Gherkin language is simply text with some keywords and a bit of structure. Tools like <\/span><a href=\"https:\/\/cucumber.io\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">Cucumber<\/span><\/a><span style=\"font-weight: 400;\"> or <\/span><a href=\"http:\/\/jbehave.org\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">JBehave<\/span><\/a><span style=\"font-weight: 400;\"> then allow us to implement a connection layer between the test specification and the interface of the system to test, which also can be used as the steps of an automated test.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To start practicing, there\u2019s a great Google Chrome plugin called <\/span><a href=\"https:\/\/chrome.google.com\/webstore\/detail\/tidy-gherkin\/nobemmencanophcnicjhfhnjiimegjeo\/related?hl=en-GB\"><i><span style=\"font-weight: 400;\">Tidy Gherkin<\/span><\/i><\/a><span style=\"font-weight: 400;\">. You can write the features in the text field above, and show what code is the necessary code to execute those steps in different languages (Java, Ruby, and JavaScript).<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-10993\" src=\"http:\/\/abstracta.us\/wp-content\/uploads\/2019\/01\/tidy-gherkin-1-min.png\" alt=\"Tidy Gherkin\" width=\"1294\" height=\"990\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"BDD_in_Action\"><\/span><strong><span style=\"color: #00b674;\">BDD\u00a0in Action<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">A good way to work with BDD might look like (this is just one example that works for us in many projects, but it\u2019s not the only one we\u2019re using):<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Having a system architecture that allows for working in \u201cslices\u201d, where stories are only finished when completed from end to end. The cake well cut!<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">When the stories are refined, write the acceptance tests in Gherkin (a tester can do it without programming knowledge).<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">At the start of the sprint, while there are no stories ready for testing, the automator (could be the tester) works on removing technical testing debt.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Once a story is ready to be tested, perform exploratory testing in order to give early feedback and also determine if the feature and its acceptance test can be automated. If so, then implement the layer that connects the feature file with the system interface. This can be done using Cucumber with some language (Java, Ruby, etc.) and with an appropriate driver, which could be Selenium for web, Appium for mobile, or RestAssured for web services.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Version the test code, the system code and the features with the same criteria.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">What are your experiences with BDD? Let me know in the comments!<\/span><\/p>\n<hr \/>\n<h2><span class=\"ez-toc-section\" id=\"Recommended_for_You\"><\/span><span style=\"font-weight: 400;\">Recommended for You<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a href=\"http:\/\/abstracta.us\/blog\/devops\/webinar-summary-bdd-cd-lisa-crispin\/\">Webinar Summary: BDD and CD with Lisa Crispin<\/a><br \/>\n<a href=\"http:\/\/abstracta.us\/blog\/software-testing\/test-automation-patterns-and-good-practices\/\">Test Automation Patterns and Good Practices<\/a><\/p>\n<p><script src=\"\/\/s7.addthis.com\/js\/300\/addthis_widget.js#pubid=ra-58d80a50fc4f926d\" type=\"text\/javascript\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A development strategy that makes sense for both your business team and tech team Behavior Driven Development (BDD), as its name indicates, is not a testing technique, but rather a development strategy (as well as TDD, which is test driven development). What it proposes is&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[636],"tags":[68,550,99,314,101],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.0.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is BDD and What Does it Mean for Testers? | Abstracta<\/title>\n<meta name=\"description\" content=\"What is BDD and how does it change testing? Learn how this strategy works within an Agile context to unite business and tech.\" \/>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is BDD and What Does it Mean for Testers? | Abstracta\" \/>\n<meta property=\"og:description\" content=\"What is BDD and how does it change testing? Learn how this strategy works within an Agile context to unite business and tech.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog about AI-powered quality engineering for teams building complex software | Abstracta\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AbstractaQA\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-28T21:33:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-05T21:23:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/abstracta.us\/wp-content\/uploads\/2019\/01\/bdd-min.png\" \/>\n\t<meta property=\"og:image:width\" content=\"560\" \/>\n\t<meta property=\"og:image:height\" content=\"315\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fltoledo\" \/>\n<meta name=\"twitter:site\" content=\"@AbstractaUS\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/abstracta.us\/blog\/#website\",\"url\":\"https:\/\/abstracta.us\/blog\/\",\"name\":\"Blog about AI-powered quality engineering for teams building complex software | Abstracta\",\"description\":\"AI-powered quality engineering\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/abstracta.us\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/abstracta.us\/wp-content\/uploads\/2019\/01\/feature.png\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/#webpage\",\"url\":\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/\",\"name\":\"What is BDD and What Does it Mean for Testers? | Abstracta\",\"isPartOf\":{\"@id\":\"https:\/\/abstracta.us\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/#primaryimage\"},\"datePublished\":\"2019-01-28T21:33:23+00:00\",\"dateModified\":\"2025-05-05T21:23:28+00:00\",\"author\":{\"@id\":\"https:\/\/abstracta.us\/blog\/#\/schema\/person\/7421e539de0357d3adb0c69ed469a1c2\"},\"description\":\"What is BDD and how does it change testing? Learn how this strategy works within an Agile context to unite business and tech.\",\"breadcrumb\":{\"@id\":\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/\",\"url\":\"https:\/\/abstracta.us\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/testing-strategy\/\",\"url\":\"https:\/\/abstracta.us\/blog\/testing-strategy\/\",\"name\":\"Testing Strategy\"}},{\"@type\":\"ListItem\",\"position\":3,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/\",\"url\":\"https:\/\/abstracta.us\/blog\/testing-strategy\/what-is-bdd\/\",\"name\":\"What is BDD and What Does it Mean for Testers?\"}}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/abstracta.us\/blog\/#\/schema\/person\/7421e539de0357d3adb0c69ed469a1c2\",\"name\":\"Federico Toledo, Chief Quality Officer at Abstracta\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/abstracta.us\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6de7ec6536c4028b5c02ad4ec1b9af0d?s=96&d=blank&r=g\",\"caption\":\"Federico Toledo, Chief Quality Officer at Abstracta\"},\"description\":\"Co-founder and COO of Abstracta\",\"sameAs\":[\"https:\/\/twitter.com\/fltoledo\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts\/10988"}],"collection":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/comments?post=10988"}],"version-history":[{"count":12,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts\/10988\/revisions"}],"predecessor-version":[{"id":12604,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/posts\/10988\/revisions\/12604"}],"wp:attachment":[{"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/media?parent=10988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/categories?post=10988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/abstracta.us\/blog\/wp-json\/wp\/v2\/tags?post=10988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}