{"id":16,"date":"2019-06-17T09:54:52","date_gmt":"2019-06-17T09:54:52","guid":{"rendered":"https:\/\/www.bddtesting.com\/?page_id=16"},"modified":"2019-06-17T10:18:00","modified_gmt":"2019-06-17T10:18:00","slug":"what-is-bdd-testing","status":"publish","type":"page","link":"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/","title":{"rendered":"What is BDD testing?"},"content":{"rendered":"\n

What\u2019s the Difference Between TDD and BDD?<\/h2>\n\n\n\n

In TDD<\/a> (Test Driven Development), the test is written to check the implementation of functionality, but as the code evolves, tests can give false results. BDD<\/a> (Behavior Driven Development) is also a test-first approach, but differs by testing the actual behavior of the system from the end users perspective.<\/p>\n\n\n\n

\"TDD<\/figure>\n\n\n\n

This article makes close analysis of TDD and BDD to see how they match or differ in their prime characteristics.<\/em><\/p>\n\n\n\n

Test Design<\/h2>\n\n\n\n

In both TDD and BDD approaches, tests are written upfront before the actual code is written. Writing tests first helps predict the course of the development, which will ultimately prevent any cases being missed from the code or functionality. Prevention of bugs will be the main aim of these approaches, and these tests will also act as concrete documentation of what is planned to be achieved in terms of test coverage.<\/p>\n\n\n\n

Test Method<\/h2>\n\n\n\n

Within these approaches, the tests are \u2018programmed\u2019. In order to write these tests, strong coding skills are required. So by programming these tests, they can be \u2018automated\u2019 for later use.<\/p>\n\n\n\n

Workflow<\/h2>\n\n\n\n

Workflow is as simple as the illustration below shows. You think, discuss and come up with ideas. These ideas will be converted into tests, with the first test being expected to fail. Code is written later that will enable the test to pass. Once the test has passed, the code will be refactored further to eventually arrive at the best design. This newly refactored code will continue to be put under test until the design has been finalized.<\/p>\n\n\n\n

\"tdd<\/figure><\/div>\n\n\n\n

Behavior vs. Test<\/h2>\n\n\n\n

\u201cWhat are you testing for?\u201d is a great question to ask. Are you testing to figure out the behavior of the application? Or are you testing the actual implementation? This is the biggest point of discussion when you talk about BDD and TDD. In BDD, you are looking for the behavior, for example, what will happen to this system under a certain condition. But in TDD you have a test for a method which will assert some conditions, but as the system evolves these tests may give you false results.<\/p>\n\n\n\n

To simplify this further, it can be written:<\/p>\n\n\n\n

In TDD, I don\u2019t care much about the output. The only thing needed is to carry out the test in a particular way.<\/em><\/p>\n\n\n\n

But in BDD, I don\u2019t mind how you come up with the output, only that the output has to be correct under the GIVEN condition.<\/em><\/p>\n\n\n\n

Communication and feedback<\/h2>\n\n\n\n

BDD has the edge over TDD in this area. Since behavior in BDD is written in simple, descriptive English, your clients will be able to understand the tests and more quickly send their feedback. These more open lines of communication allow you to better incorporate their feedback to improve the tests and design of the software further. In TDD, only skillful programmers can understand the test, which of course, limits communication with the wider audience but this method will deliver code of a higher quality.<\/p>\n\n\n\n

Again, but in simpler words:<\/p>\n\n\n\n

In BDD you will come across a better specification since communication between the software developer and product owner is fast and easy.<\/em><\/p>\n\n\n\n

TDD may lack the ability to specify the exact behavior, but you achieve higher quality with software code.<\/em><\/p>\n\n\n\n

Writing Failing Tests vs. Writing Failing Feature Tests<\/h2>\n\n\n\n

As discussed, both approaches start with writing a failing test and then picking it up from there. In BDD, a test is written that can satisfy both the developer and customer, but in TDD you write a test that will only satisfy a developer and the code they write. As can be seen below, BDD works over TDD, which will make TDD implementation a better approach. So you can never say that BDD and TDD are entirely two different things.<\/p>\n\n\n\n

\"TDD<\/figure><\/div>\n\n\n\n

Summary<\/h2>\n\n\n\n

Although we say BDD is a better approach, we must not forget that BDD has actually evolved from TDD, as a way to eliminate the shortfalls of TDD. So there is absolutely no harm in implementing both approaches \u2013 one to support the quality of the code the developer writes, and the other to support the behavior of the system defined by the product owner.<\/p>\n\n\n\n

\nhttps:\/\/blog.testlodge.com\/tdd-vs-bdd\/\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"

What\u2019s the Difference Between TDD and BDD? In TDD (Test Driven Development), the test is written to check the implementation of functionality, but as the code evolves, tests can give false results. BDD (Behavior Driven Development) is also a test-first approach, but differs by testing the ….  Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"class_list":["post-16","page","type-page","status-publish","hentry"],"yoast_head":"\nWhat is BDD testing? • BDD Testing<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is BDD testing? • BDD Testing\" \/>\n<meta property=\"og:description\" content=\"What\u2019s the Difference Between TDD and BDD? In TDD (Test Driven Development), the test is written to check the implementation of functionality, but as the code evolves, tests can give false results. BDD (Behavior Driven Development) is also a test-first approach, but differs by testing the ....  Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/\" \/>\n<meta property=\"og:site_name\" content=\"BDD Testing\" \/>\n<meta property=\"article:modified_time\" content=\"2019-06-17T10:18:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.testlodge.com\/wp-content\/uploads\/2017\/11\/tdd-vs-bdd-1024x538.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/\",\"url\":\"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/\",\"name\":\"What is BDD testing? • BDD Testing\",\"isPartOf\":{\"@id\":\"https:\/\/www.bddtesting.com\/#website\"},\"datePublished\":\"2019-06-17T09:54:52+00:00\",\"dateModified\":\"2019-06-17T10:18:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.bddtesting.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is BDD testing?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.bddtesting.com\/#website\",\"url\":\"https:\/\/www.bddtesting.com\/\",\"name\":\"BDD Testing\",\"description\":\"Behavior-driven development testing\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.bddtesting.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is BDD testing? • BDD Testing","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/","og_locale":"en_US","og_type":"article","og_title":"What is BDD testing? • BDD Testing","og_description":"What\u2019s the Difference Between TDD and BDD? In TDD (Test Driven Development), the test is written to check the implementation of functionality, but as the code evolves, tests can give false results. BDD (Behavior Driven Development) is also a test-first approach, but differs by testing the ....  Read More","og_url":"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/","og_site_name":"BDD Testing","article_modified_time":"2019-06-17T10:18:00+00:00","og_image":[{"url":"https:\/\/blog.testlodge.com\/wp-content\/uploads\/2017\/11\/tdd-vs-bdd-1024x538.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/","url":"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/","name":"What is BDD testing? • BDD Testing","isPartOf":{"@id":"https:\/\/www.bddtesting.com\/#website"},"datePublished":"2019-06-17T09:54:52+00:00","dateModified":"2019-06-17T10:18:00+00:00","breadcrumb":{"@id":"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bddtesting.com\/what-is-bdd-testing\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bddtesting.com\/what-is-bdd-testing\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.bddtesting.com\/"},{"@type":"ListItem","position":2,"name":"What is BDD testing?"}]},{"@type":"WebSite","@id":"https:\/\/www.bddtesting.com\/#website","url":"https:\/\/www.bddtesting.com\/","name":"BDD Testing","description":"Behavior-driven development testing","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bddtesting.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.bddtesting.com\/wp-json\/wp\/v2\/pages\/16"}],"collection":[{"href":"https:\/\/www.bddtesting.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bddtesting.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bddtesting.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bddtesting.com\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":2,"href":"https:\/\/www.bddtesting.com\/wp-json\/wp\/v2\/pages\/16\/revisions"}],"predecessor-version":[{"id":28,"href":"https:\/\/www.bddtesting.com\/wp-json\/wp\/v2\/pages\/16\/revisions\/28"}],"wp:attachment":[{"href":"https:\/\/www.bddtesting.com\/wp-json\/wp\/v2\/media?parent=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}