{"id":712,"date":"2015-09-18T10:03:28","date_gmt":"2015-09-18T10:03:28","guid":{"rendered":"http:\/\/www.gallop.net\/blog\/?p=712"},"modified":"2018-09-25T14:49:42","modified_gmt":"2018-09-25T09:19:42","slug":"test-vs-behavior-driven-development","status":"publish","type":"post","link":"https:\/\/www.cigniti.com\/blog\/test-vs-behavior-driven-development\/","title":{"rendered":"Test driven development vs Behavior driven development"},"content":{"rendered":"
Test driven development,<\/strong> as the name implies, is driven by a number of tests. After a unit test is written, it is then run against a code that is as yet unwritten. The tests naturally fail, and so the second task is to write code that allows the test to pass. The problem here is that the code itself is bound to be full of bugs – and when developers put their time into writing all kinds of test code without writing any production code, it comes across as a futile undertaking.<\/p>\n Suppose a unit test is written to test a new class, the tests assign a particular attribute to the class and attempt to mimic this attribute. In such cases, what is being tested is the capacity of the code to accept a given value and the likelihood of retrieving it. What is ultimately tested is the compiler or the interpreter – and so nothing of any substance is tested.<\/p>\n Yes, such code can perhaps advance into something more complicated, in which case that unit test code can help avoid regression. But, this usually doesn\u2019t happen on a scale significant enough to justify the initial investment of time and money, and such far-reaching changes in any case would nullify the unit tests when more complex computations enter the scene.<\/p>\n No organization wants to waste resources, which is why it\u2019s doubly important to assess when and for what purposes one should employ unit tests. Complete test-coverage is a needless burden. And the fundamental issue with this kind of development is that the developer, under perpetual time pressure, cannot realistically be expected to build a well-integrated product; it\u2019s more likely that they\u2019ll construct something for the purpose of doing, no more than just passing that particular test. Furthermore, this process tends to undermine talented developers, because anyone in possession of a code-editing platform can take on the role and do a poor job.<\/p>\n In making a system testable, developers consciously or unconsciously apply quite severe restrictions on the architecture, a measure that ends up over complicating the code and actually obstructs the problem-solving process for businesses. This approach could apply to very complex systems, but in a world where technologies and methods get outdated every few years, the long-term resilience of a given software architecture should not be a priority. What should matter in fact, is the accessibility of the current software and its delivery period.<\/p>\n A testing method, therefore, cannot demand the reconfiguration of stable architecture. And this is exactly what test driven development demands, which makes it inefficient and in need of replacement by a more appropriate, relevant, and modern alternative. This is where the Behavior driven development<\/strong> comes in.<\/p>\n This method starts in the same way as its ancestor (defining the tests that need to be passed), but devotes more attention to a system\u2019s overall functionality instead of the details of its primary construction. It also closes the gap between developers and users by operating on an easy-to-learn language called Gherkin.<\/p>\n Essentially, if one shifts from the test-driven to the behavior-driven development, one can divert one\u2019s attention away from the actual tests to the requirements of the application, and focus on making sure that the behavior of the app conforms to these specific requirements.<\/p>\n But the decision of which method to use comes down to the nature of your framework and your target language. And even though the behavior-driven development can prevent issues, its success is not guaranteed in this regard. Poorly written code and outdated design practices cannot be eliminated altogether, but the likelihood of writing buggy tests is admittedly lower.<\/p>\n","protected":false},"excerpt":{"rendered":" Test driven development, as the name implies, is driven by a number of tests. After a unit test is written, it is then run against a code that is as yet unwritten. The tests naturally fail, and so the second task is to write code that allows the test to pass. The problem here is […]<\/p>\n","protected":false},"author":2,"featured_media":12897,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[883,29,218,1650,435],"ppma_author":[3736],"authors":[{"term_id":3736,"user_id":2,"is_guest":0,"slug":"admin","display_name":"Cigniti Technologies","avatar_url":{"url":"https:\/\/www.cigniti.com\/blog\/wp-content\/uploads\/120X120-1.png","url2x":"https:\/\/www.cigniti.com\/blog\/wp-content\/uploads\/120X120-1.png"},"user_url":"http:\/\/www.cigniti.com\/","last_name":"Technologies","first_name":"Cigniti","job_title":"","description":"Cigniti is the world\u2019s leading AI & IP-led Digital Assurance and Digital Engineering services company with offices in India, the USA, Canada, the UK, the UAE, Australia, South Africa, the Czech Republic, and Singapore. We help companies accelerate their digital transformation journey across various stages of digital adoption and help them achieve market leadership."}],"_links":{"self":[{"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/posts\/712"}],"collection":[{"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/comments?post=712"}],"version-history":[{"count":0,"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/posts\/712\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/media\/12897"}],"wp:attachment":[{"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/media?parent=712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/categories?post=712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/tags?post=712"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.cigniti.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}