Note that there are some explanatory texts on larger screens.

plurals
  1. PODo setup/teardown hurt test maintainability?
    text
    copied!<p><em>This seemed to spark a bit of conversation on <a href="https://stackoverflow.com/questions/1076263/teaching-testing-habits-to-other-developers/1076288#1076288">another question</a> and I thought it worthy to spin into its own question.</em></p> <p>The DRY principle seems to be our weapon-of-choice for fighting maintenance problems, but what about the maintenance of <strong>test code</strong>? Do the same rules of thumb apply?</p> <p>A few strong voices in the developer testing community are of the opinion that setup and teardown are harmful and should be avoided... to name a few:</p> <ul> <li><a href="http://jamesnewkirk.typepad.com/posts/2007/09/why-you-should-.html" rel="nofollow noreferrer">James Newkirk</a></li> <li><a href="http://architects.dzone.com/news/testing-duplicate-code-your-te" rel="nofollow noreferrer">Jay Fields</a>, [<a href="http://blog.jayfields.com/2009/06/developer-testing-welcome-to-beta-test.html" rel="nofollow noreferrer">2</a>]</li> </ul> <p>In fact, xUnit.net has removed them from the framework altogether for this very reason (though there are <a href="http://xunit.codeplex.com/Wiki/View.aspx?title=Comparisons" rel="nofollow noreferrer">ways to get around this self-imposed limitation</a>).</p> <p>What has been your experience? Do setup/teardown hurt or help test maintainability?</p> <p><strong>UPDATE</strong>: do more fine-grained constructs like those available in JUnit4 or TestNG (@BeforeClass, @BeforeGroups, etc.) make a difference?</p>
 

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