<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lucas Viola on Medium]]></title>
        <description><![CDATA[Stories by Lucas Viola on Medium]]></description>
        <link>https://medium.com/@lucasmatzenbacher?source=rss-f5c8a8edf161------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ervQL7ovCBllORxd.</url>
            <title>Stories by Lucas Viola on Medium</title>
            <link>https://medium.com/@lucasmatzenbacher?source=rss-f5c8a8edf161------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 09:36:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lucasmatzenbacher/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[7 practical tips that will improve your Test Driven Development capabilities]]></title>
            <link>https://medium.com/@lucasmatzenbacher/7-practical-tips-that-will-improve-your-test-driven-development-capabilities-f6827bcfc50a?source=rss-f5c8a8edf161------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6827bcfc50a</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[test-driven-development]]></category>
            <category><![CDATA[test-driven-design]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Lucas Viola]]></dc:creator>
            <pubDate>Tue, 21 Jan 2020 22:50:24 GMT</pubDate>
            <atom:updated>2020-01-21T22:50:24.057Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Ab7g5jOB_5D6jqDPDJjvw.jpeg" /></figure><p>Just some insights I picked up during my journey using and teaching the discipline of TDD.</p><ol><li><strong>First tip: Dedicate a little bit of time to think about the name of your test.</strong></li></ol><p>A common mistake that people that are new to TDD make is: they start out their test scenarios with generic or non-related names. Surely you do not need to spend hours and hours to decide the perfect test name before getting into writing it, in fact you WILL end up changing it later, but dedicating a little bit of time to think about the scenario you want to test upfront and translating it into a relatively good name will help you understanding more about the functionality you want to implement and not making assumptions about it. Which is VERY important, because taking assumptions on your test cases could lead to bad design decisions.</p><p>Little extra tip: Do not forget that tests can also serve the purpose of documenting your code! Your colleagues and even you can — in the future — read them to have a better undestanding of what the code does.</p><p><strong>2. Second tip: When starting to sketch the test, start bottom up!</strong></p><p>One common problem that people often fall into when designing test cases is they get blocked while thinking about the context setup of what is being tested so this is a very important tip that will change your life forever: Starting your test cases bottom up, writing first the assertion part (the &quot;then&quot;), then the action part (the &quot;when&quot;) and then the context setup will help you solve this problem. Because doing it that way you will not have to think about all the different components and interactions that are necessary in order to your test case to be executed. You will think about what the interface of the component of you are designing looks like and the will magically appear to you!</p><p>This, in fact, is a very well known TDD design pattern called &quot;assert first&quot;. And exercising it will help you understand the reason why TDD can also mean &quot;Test Driven Design&quot;: By starting assertion first you are leading the design of your application using pragmatically (and programatically) using your tests to reason about what the interfaces of your components look alike, exercising the principle to program to interfaces not implementations, which will result in overall better design choices. While if you start top down, you would guide your tests by a pre-existing implementation that lives in your head.</p><p><strong>3. Third tip: Organize your tests using the Given/When/Then pattern.</strong></p><p>Better known in the TDD world as &quot;The Three A&#39;s&quot;, being them (starting top down) the Arrange: the context setup, the Act: the exercise of the system that is being tested (AKA the SUT or System Under Test), and the Assert: the comparison of the actua result of the action with the desired result, which will guarantee your code works the way it should be. If you organize them this way, instead of mixing up &quot;the A&#39;s&quot; your test scenarios clean, easy to read and easy to maintain.</p><p><strong>4. Fourth tip: Never forget to baby step!</strong></p><p>One of the most common mistakes that people who are starting out on their TDD journey do is forget that Test Driven Development means &quot;test first&quot;, go straight to the implementation and bite off more than they can chew, writing more than what was specified in the test case. Remember always: BABY STEPS!</p><p>Chances are that if you use or have tried to use TDD on your projects you went through this: wrote a test case, made it pass, wrote more production code that you did not anticipate by your tests, tried to go back to testing…and things got all messed up! Then you went yo the TDD evangelist that you were pairing with and said that &quot;TDD does not work!&quot;.</p><p>If you are starting on TDD you have to trust me on this one. Forgetting baby steps will keep you from reaping the best gift that TDD gives to you which is let your tests guide the design of your functionality with the goal of creating code that is simple (but elegant), testable and that work (self-tested code). By combining this idea with the previous tip, you have power on your hands. Use it. If you jump straight to the implementation you WILL add unnecessary complexity to your code.</p><p><strong>5. Fifth tip: Do not underestimate the third step!</strong></p><p>The test first approach may sometimes lead us to write code that is too simple (when you hardcode a value just to make a test pass, for example), or even too complex. This is why it is important not to forget that the TDD cycle is: Red, Green, Refactor. Refactor always! Use the fact that you have in front of you a code that was born with a test attached to it and change your code with peace in your mind so to make it more readable and simpler and/or performatic. Refactored code is cleaner code!</p><p><strong>6. Sixth tip: Practice, practice and…practice!</strong></p><p>People often forget that TDD is a discipline and, like every discipline such as math or martial arts, for you to get good at it you need to practice. You are not going to become a black belt or learn how to solve polinomial functions overnight. It takes time and practice. In the beginning it is going to be hard, it is probably going to take a while for you to reap the benefits of the test first approach, but once it kicks in it is going to be worth it. Kent Beck would not write a book on it if it was waste, right? (humor, folks). Think about it like this: you don&#39;t need to get a black belt, but it surely will make your life easier. You don&#39;t need to learn or even use TDD, but the things you will pick up while learning it will make an overall better programmer.</p><p>For you to accelerate the process, it is useful if you can do some pair programming session with someone more experienced. Or practice some TDD Katas (another martial art analogy) from time to time. This will hardcode the ideas of TDD into your brain and make it more natural to you.</p><p><strong>7. Seventh tip: If you do not have a clear-ish understanding of the path ahead of you do not insist on TDD!</strong></p><p>This is a special one. For you that read all the way and got here. I have seen people stuck for hours thinking about how test a specific thing, get frustrated because they are not evolving and give up on TDD. This usually happens because they lack the basic understanding of what they are implementing. Folks, this happens with everyone! Even if you have been doing this for years.</p><p>If you do not have a good knowledge about the domain problem you are solving through code, or if you are using a library/framework that is new to you it can get pretty difficult to test. When this happens you can do what I call &quot;sketch coding&quot;, go to the implementation and start sketching freely (not worrying about quality or syntax) what you want to develop until you have a better grasp of what it is. Then erase everything, go to the tests and start out again :)</p><p>That&#39;s it folks. Hope it was useful.</p><p>If you come from a portuguese speaking background, or understand portugues, I have created an youtube video explaining a little bit of the above. <a href="https://www.youtube.com/watch?v=aie235ADIr4">Please check it here.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6827bcfc50a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>