<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tdd Archives - Yumasoft</title>
	<atom:link href="https://blog.yumasoft.pl/tag/tdd/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.yumasoft.pl/tag/tdd/</link>
	<description>Software development blog</description>
	<lastBuildDate>Thu, 21 Oct 2021 02:37:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://blog.yumasoft.pl/wp-content/uploads/2021/05/cropped-yumasoft_icon_transparent-32x32.png</url>
	<title>tdd Archives - Yumasoft</title>
	<link>https://blog.yumasoft.pl/tag/tdd/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>When Not To Use TDD?</title>
		<link>https://blog.yumasoft.pl/2021/10/when-not-to-use-tdd/</link>
					<comments>https://blog.yumasoft.pl/2021/10/when-not-to-use-tdd/#respond</comments>
		
		<dc:creator><![CDATA[Dawid Sibiński]]></dc:creator>
		<pubDate>Thu, 21 Oct 2021 06:00:00 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[software testing]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[test driven development]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>
		<guid isPermaLink="false">https://blog.yumasoft.pl/?p=719</guid>

					<description><![CDATA[<p>Some time ago we talked about 7 reasons to start using Test Driven Development. As soon as you learn it and start practicing it on a daily basis, it might be tempting to always be TDDing. However, TDD is not always a good fit. There are some cases when it might not be worth using&#8230;</p>
<p>The post <a rel="nofollow" href="https://blog.yumasoft.pl/2021/10/when-not-to-use-tdd/">When Not To Use TDD?</a> appeared first on <a rel="nofollow" href="https://blog.yumasoft.pl">Yumasoft</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Some time ago we talked about <a href="https://blog.yumasoft.pl/2021/09/7-reasons-to-start-doing-test-driven-development/">7 reasons to start using Test Driven Development</a>. As soon as you learn it and start practicing it on a daily basis, it might be tempting to always be <em>TDDing</em>. However, TDD is not always a good fit. There are some cases when it might not be worth using TDD. Let&#8217;s explore them today ?</p>



<span id="more-719"></span>



<h2 class="wp-block-heading">Prototypes</h2>



<p class="wp-block-paragraph">You may consider not doing TDD with prototypes. By <em>prototype</em>, I mean an app that will most probably be thrown away or completely changed very soon. It may be created when you are experimenting with some technology/framework or are just asked to <em>conduct research</em> on something.</p>



<p class="wp-block-paragraph">TDD gives you a high code/flow coverage, which may need to be changed in case of prototype projects. If you are in such situation, consider resigning from TDD at this stage.</p>



<h2 class="wp-block-heading">Short living apps</h2>



<p class="wp-block-paragraph">Similarly to prototypes, short living solutions might be the ones where TDD is not the best fit. It applies to one-time-use apps or scripts which are supposed to do one thing well and quickly.</p>



<p class="wp-block-paragraph">Short living apps are the ones where you may consider not using Test Driven Development. I&#8217;d even argue whether you need any kind of tests for such programs. Testing such apps or even scripts may be art for art&#8217;s sake. If something is supposed to realize a given task without fireworks (like reusability, maintenance etc.), I wouldn&#8217;t bother with testing it. It&#8217;s better to focus on solving your current, short-lived problem than on practicing the profound TDD idea ?</p>



<h2 class="wp-block-heading">Unclear requirements</h2>



<p class="wp-block-paragraph">One of the reasons not to use TDD might be unclear requirements. The idea of writing tests in Test Driven Development is to define the expected outcomes for predefined incomes. As we said <a href="https://blog.yumasoft.pl/2021/09/7-reasons-to-start-doing-test-driven-development/">in the previous article</a>, Test Driven Development can help spot the edge cases and make the business requirements more <em>close to the code</em>. However, if you don&#8217;t have these requirements defined, TDD might be a waste of time (at this stage). If the requirements actually arrive or are completely changed, your significant set of tests will need to be changed or even removed.</p>



<h2 class="wp-block-heading">MVP</h2>



<p class="wp-block-paragraph">If you&#8217;re creating an <a href="https://en.wikipedia.org/wiki/Minimum_viable_product">MVP</a>, with very short time and budget, TDD might not be worth the struggle. It&#8217;s probably better to resign from using TDD in that case. You should rather focus on your product and the business value it needs to deliver. TDD might slow down the delivery time, which, in case of MVPs, can be critical. It&#8217;s better to deliver the minimum viable product without TDD than to not deliver it with TDD ?</p>



<p class="wp-block-paragraph">However, remember to add some tests, even post-factum. MVPs have a high chance of survival, so you&#8217;d want your final product to be tested and testable. You need to find a good balance here, not to make your solution completely untestable when it&#8217;s ready for production use.</p>



<h2 class="wp-block-heading">Tests writing beginner</h2>



<p class="wp-block-paragraph">If you are a total beginner in writing tests in general, Test Driven Development might not be the best approach to start with. You may consider not to use TDD at the beginning of your testing journey.</p>



<p class="wp-block-paragraph">To make Test Driven Development effective, you should be able to write tests quickly and efficiently. Starting to learn software testing with Test Driven Development may make you feel overwhelmed and discouraged. If you&#8217;re a beginner, I suggest to first write some unit tests, get familiar with that and then try to learn Test Driven Development. </p>



<p class="wp-block-paragraph">It would be great if you can find some smaller and well-defined task to start with TDD. If you don&#8217;t have such tasks, try solving one of the programming katas (e.g. <a href="https://codingdojo.org/kata/StringCalculator/">this one</a>) with TDD. </p>



<h2 class="wp-block-heading">When not to use TDD &#8211; summary</h2>



<p class="wp-block-paragraph">Like everything, TDD is not a gold standard for every possible case. It should be used as often as possible, but not always. Remember to always weight the gains and losses from using Test Driven Development in a given project or application at a given time.</p>



<p class="wp-block-paragraph">What&#8217;s your experience with Test Driven Development? Can you list any more cases where it&#8217;s not worth using it? Share your thoughts in the comments below!</p>
<p>The post <a rel="nofollow" href="https://blog.yumasoft.pl/2021/10/when-not-to-use-tdd/">When Not To Use TDD?</a> appeared first on <a rel="nofollow" href="https://blog.yumasoft.pl">Yumasoft</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.yumasoft.pl/2021/10/when-not-to-use-tdd/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>7 Reasons To Start Doing Test Driven Development</title>
		<link>https://blog.yumasoft.pl/2021/09/7-reasons-to-start-doing-test-driven-development/</link>
					<comments>https://blog.yumasoft.pl/2021/09/7-reasons-to-start-doing-test-driven-development/#respond</comments>
		
		<dc:creator><![CDATA[Dawid Sibiński]]></dc:creator>
		<pubDate>Mon, 20 Sep 2021 10:00:00 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[software testing]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[test driven development]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tests]]></category>
		<guid isPermaLink="false">https://blog.yumasoft.pl/?p=656</guid>

					<description><![CDATA[<p>Why should you start doing Test Driven Development (TDD) today? What are the benefits of TDD, and how can it help the developers and business? Let&#8217;s explore 7 reasons everyone should be TDD-ing ? Moving design into code With test driven development, you create your tests before writing production code*. Having that in mind, one&#8230;</p>
<p>The post <a rel="nofollow" href="https://blog.yumasoft.pl/2021/09/7-reasons-to-start-doing-test-driven-development/">7 Reasons To Start Doing Test Driven Development</a> appeared first on <a rel="nofollow" href="https://blog.yumasoft.pl">Yumasoft</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Why should you start doing Test Driven Development (TDD) today? What are the benefits of TDD, and how can it help the developers and business? Let&#8217;s explore 7 reasons everyone should be TDD-ing ?</p>



<span id="more-656"></span>



<h2 class="wp-block-heading">Moving design into code</h2>



<p class="wp-block-paragraph">With test driven development, you create your tests before writing production code*.</p>



<p class="wp-block-paragraph">Having that in mind, one of the benefits of using TDD is that you need to <strong>move your design requirements into code before you even write a single line of business logic</strong>.</p>



<p class="wp-block-paragraph">It means that you need to spend time thinking about <a href="https://blog.yumasoft.pl/2021/07/why-naming-tests-matters/">good names</a> for your tests. I often create empty tests straightaway after staring to work on a task. Spending time to create well-named test methods can help you quickly spot missing parts in the design.</p>



<p class="wp-block-paragraph"><span style="text-decoration: underline;">*By <em>production code</em> I mean the actual business logic <em>except</em> the tests&#8217; code. This is only to differentiate here, but I personally consider my tests part of the production code in real life. Tests are as important as all the code.</span></p>



<h2 class="wp-block-heading">Finding edge cases</h2>



<p class="wp-block-paragraph">Going further, if you create many empty tests with well-thought names, you will surely find many edge cases. Thanks to test driven development, <strong>you&#8217;ll verify the business requirements by your code <em>without </em>writing even a single line of it</strong>. Discovering edge cases and boundary conditions will let you <strong>clarify the requirements or even change/adjust them <em>before </em>any production code is written</strong> ?</p>



<h2 class="wp-block-heading">Structuring your code beforehand</h2>



<p class="wp-block-paragraph">You&#8217;ll see that TDD forces you to think about the code you&#8217;re about to write beforehand. You&#8217;re going to think about production code to-be-written: how and where to add it, what methods, parameters and classes are needed. Thanks to that, you can quickly notice that maybe the place you&#8217;d normally place the new code in is not the best choice. Maybe it requires too much changing instead of modifying.</p>



<p class="wp-block-paragraph">Such approach leads to <strong>taking and rethinking architectural and structural decisions before writing a single line of production code</strong>. In the end, it saves you a lot of time. Without TDD, you&#8217;d probably just add this new code where you thought it&#8217;s appropriate and struggle to refactor it later. And refactoring without tests is dangerous ?</p>



<h2 class="wp-block-heading">Allowing to refactor</h2>



<p class="wp-block-paragraph">Test driven development is based on <a href="https://blog.cleancoder.com/uncle-bob/2014/12/17/TheCyclesOfTDD.html">red-green-refactor cycle</a>. <strong>As soon as your test is green, you can safely (for sure much more safely than without tests, especially if you combine TDD with <a href="https://blog.yumasoft.pl/2021/08/make-your-tests-bulletproof-with-mutation-testing/">mutation testing</a>) refactor the code you&#8217;ve just written</strong>.</p>



<p class="wp-block-paragraph">In the end, the quality of your code is much higher than it would be without tests. You don&#8217;t feel the <em>fear of refactoring</em>, which is a common blocker for improving code quality in legacy systems.</p>



<h2 class="wp-block-heading">Making implementation very easy</h2>



<p class="wp-block-paragraph">When you move from red to green phases of TDD, it&#8217;s time for implementation. From my experience, <strong>writing production code that satisfies TDD-produced tests is very easy</strong>. </p>



<p class="wp-block-paragraph">I find it much easier than writing code not covered by TDD-based tests. You exactly know what to do and which tests must pass. Thanks to that, your implementation is minimal &#8211; it should only make the test(s) green.</p>



<h2 class="wp-block-heading">Creating current code documentation</h2>



<p class="wp-block-paragraph">Implementing a new feature with test driven development will leave you with a comprehensive set of tests. From my experience, I write few times more tests with TDD than in a &#8220;traditional&#8221; <em>tests-after-code</em> mode.</p>



<p class="wp-block-paragraph">As a nice side effect, <strong>you&#8217;re building and growing the only possible, current documentation of your code &#8211; set of your tests</strong>. Only tests can tell you the truth about your code. It can&#8217;t be achieved with any other kind of documentation. Notice one more advantage &#8211; <strong>you&#8217;re creating documentation&#8230; <em>without </em>writing any documentation!</strong> ?</p>



<p class="wp-block-paragraph">Current, well-named tests are very helpful not only for developers, but also for the so-called <a href="https://blog.yumasoft.pl/2021/07/why-naming-tests-matters/#How_naming_tests_well_can_help_the_business">business people</a>.</p>



<h2 class="wp-block-heading">Spotting architectural problems</h2>



<p class="wp-block-paragraph">Last but not least, test driven development helps to solve application&#8217;s architectural problems. Tests should be relatively easy to write.<strong> If the test is hard to write before production code exists, it might mean that the architecture of your solution is wrong.</strong> There&#8217;s a problem somewhere that should be addressed.</p>



<p class="wp-block-paragraph">That&#8217;s why it&#8217;s very important to start working with TDD as early as possible in your project. There might be some cases where TDD it not suitable (maybe I&#8217;ll write a separate article about it ?), but in quite mature and stable projects, it should be a gold standard. Altering the architecture is much easier early in the project. </p>



<p class="wp-block-paragraph"></p>
<p>The post <a rel="nofollow" href="https://blog.yumasoft.pl/2021/09/7-reasons-to-start-doing-test-driven-development/">7 Reasons To Start Doing Test Driven Development</a> appeared first on <a rel="nofollow" href="https://blog.yumasoft.pl">Yumasoft</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.yumasoft.pl/2021/09/7-reasons-to-start-doing-test-driven-development/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
