Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you should not change your test code.</p> <p>Why? In TDD, you define a interface for a class. This interface contains methods that are defined with a certain set of functionality.The <strong>requirements</strong> / <strong>design</strong>.</p> <p><strong>First:</strong> These requirements do not change while refactoring your production code. Refactoring means: changing/cleaning the code without changing the functionality.<br> <strong>Second:</strong> The test checks a certain set of functionality, this set stays the same.</p> <p><strong>Conclusion:</strong> Refactoring test and refactoring your production code are two different things.</p> <p>Tip:When write your tests, write clean code. Make small tests. Which really test one piece of the functionality.</p> <p>But "Your design changes because of unforeseen changes to the requirements". This <strong>may</strong> lead or <strong>may not</strong> lead to changes in the interface.<br> When your requirements change, your tests must change. This is not avoidable.<br> You have to keep in mind that this is a <strong>new</strong> TDD cycle. First test the new functionality and remove the old functionality tests. Then implement the new design.</p> <p>To make this work properly, you need clean and small tests. Example:</p> <pre><code>MethodOne does: changeA and changeB Don't put this in 1 unit test, but make a test class with 2 unit tests. Both execute MethodOne, but they check for other results (changeA, changeB). When the specification of changeA changes, you only need to rewrite 1 unit method. When MethodOne gets a new specification changeC: Add a unit test. </code></pre> <p>With the above example your tests will be more agile and easier to change.</p> <p>Summary: </p> <ul> <li>Dont refactor your tests, when refactoring your production code.</li> <li>Write clean and agile tests.</li> </ul> <p>Hopes this helps. Good luck with it.</p> <p>@disclaimer: I do not want your money if this makes you rich.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload