<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Derik Whittaker : Methodology, TDD</title><link>http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/TDD/default.aspx</link><description>Tags: Methodology, TDD</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>Failing builds, the sound of silence</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/11/07/failing-builds-the-sound-of-silence.aspx</link><pubDate>Wed, 07 Nov 2007 13:00:48 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38803</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38803</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38803</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/11/07/failing-builds-the-sound-of-silence.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;m sure that everyone has heard the&amp;nbsp;riddle &amp;#39;&lt;strong&gt;If a tree falls in a forest and no one is around to hear it, does it make a sound?&amp;#39;&lt;/strong&gt;.&amp;nbsp; This riddle is all about observation and knowledge of reality.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Well,&amp;nbsp;I have a riddle for software teams following TDD.&amp;nbsp; &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&amp;#39;If a build fails and no-one fixes it, did it actually fail?&amp;#39;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38803" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Humor/default.aspx">Humor</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category></item><item><title>Backing in Unit Tests into an existing project</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/09/backing-in-unit-tests-into-an-existing-project.aspx</link><pubDate>Tue, 09 Oct 2007 12:35:39 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38646</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38646</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38646</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/09/backing-in-unit-tests-into-an-existing-project.aspx#comments</comments><description>&lt;p&gt;Recently I was asked about backing in unit tests into an existing project.&amp;nbsp; In particular I was asked&amp;nbsp;A) was possible and B) is it worth it.&amp;nbsp; In short my answers to both these are Yes and Yes.&amp;nbsp; However, backing in unit tests is not without its challenges.&amp;nbsp; I thought today I would go express my experiences with doing exactly this and what types of hurdles I ran into.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Start off by only testing new code&lt;br /&gt;&lt;/strong&gt;When backing in tests, it is very important to accept the fact that a large percentage of your application is going to be untested.&amp;nbsp; Accepting this fact will help you move forward.&amp;nbsp; I would suggest that as you write new code (be it new modules, features or&amp;nbsp;whatever) you write them following the TDD practice.&amp;nbsp; This will be the simplest way to get the ball rolling.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Doing this is also an easy way to get other team members on board with the testing idea.&amp;nbsp; I know from personal experience that when we wanted to started following TDD on a project that was 2 years in, many of the other developers thought it was a waste because we have so much that is untested.&amp;nbsp; They thought it would take too much time/effort to write test for existing code.&amp;nbsp; I agree with this.&amp;nbsp; So only test going forward&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Add tests to existing code only when changes are needed&lt;br /&gt;&lt;/strong&gt;I know I just said above to only test new code, and this is true.&amp;nbsp; However, when you are making changes to existing code test those changes.&amp;nbsp; Again, you don&amp;#39;t have to try to test all the existing code, only the path ways you are adding/changing.&amp;nbsp; &lt;/p&gt; &lt;p&gt;If you follow this, over time you will start to build a nice suite of tests that tests not only new code, but some existing code as well.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Mock as much as possible&lt;br /&gt;&lt;/strong&gt;Mocking is a great tool.&amp;nbsp; I like to mock code that I don&amp;#39;t have control over, or when I have no faith the code will work reliably.&amp;nbsp; This is especially&amp;nbsp;important&amp;nbsp;in a project that does not have tests.&amp;nbsp; &lt;/p&gt; &lt;p&gt;An example would be this.&amp;nbsp; Lets say you&amp;nbsp;are&amp;nbsp;adding a new feature to an application that needs to call into some sort of calculation engine.&amp;nbsp; Since this calculation engine is not tested and you have no real faith that it will work&amp;nbsp;reliably,&amp;nbsp;mock it.&amp;nbsp; &amp;nbsp;You should know that given a valid set of inputs you expect to receive a given response.&amp;nbsp; By mocking this you remove all risk of the calculation engine failing thus causing your tests to fail.&amp;nbsp; &lt;/p&gt; &lt;p&gt;*** I can hear you now,&amp;nbsp;you want&amp;nbsp;your test to fail when the calculation engine fails.... No you don&amp;#39;t.&amp;nbsp; Unless your test is actually testing the calculation engine, you don&amp;#39;t care if it passes or fails.&amp;nbsp; You just need to call it. ***&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Take this as a learning experience&lt;br /&gt;&lt;/strong&gt;Take this time as a way to learn to write good solid tests.&amp;nbsp; This will be of great benefit later in your next project.&amp;nbsp; Also, you will also learn how to write better code that is more acceptable to testing (hum... sounds like another good post).&amp;nbsp; Remember, in order to become good at something you must first be bad at it.&amp;nbsp; But with practice you will become better and you will be a better developer because of it.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Be patient&lt;br /&gt;&lt;/strong&gt;Testing is painful at first.&amp;nbsp; It is a shift in your development mind set.&amp;nbsp; Be patient, it gets better.&amp;nbsp; This is no different then learning anything else.&amp;nbsp; It will take time, but eventually you will become comfortable with TDD and it will become second nature.&amp;nbsp; You never know, you may end up like me and find it odd when you are NOT writing tests.&lt;/p&gt; &lt;p&gt;I hope this helps.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38646" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category></item><item><title>Why I believe IN and WRITE unit tests</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/01/why-i-believe-in-and-write-unit-tests.aspx</link><pubDate>Tue, 02 Oct 2007 00:27:25 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38554</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38554</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38554</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/01/why-i-believe-in-and-write-unit-tests.aspx#comments</comments><description>&lt;p&gt;In my last post I think I struck a cord with some people in my post &amp;#39;Unit tests taking too much time&amp;#39;.&amp;nbsp; My intent was NOT to sound like an elitist Agilist or any else of that nature.&amp;nbsp; My intent was simply to put a post out there about the misperception (in my opinion) about how writing unit tests take too much time.&lt;/p&gt; &lt;p&gt;I thought I would put my &amp;#39;retort&amp;#39; on why I believe in&amp;nbsp;and write unit tests.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows&amp;nbsp;ME to write better code&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I believe that when&amp;nbsp;I truly follow TDD practices&amp;nbsp;my code comes out simpler.&amp;nbsp; I have also found, that my code tends to follow&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/YAGNI" target="_blank"&gt;YAGNI&lt;/a&gt;&amp;nbsp;more so then when I don&amp;#39;t follow TDD practices.&lt;/p&gt; &lt;p&gt;Here is an example from my past experience.&amp;nbsp; On a prior project I needed to build a &amp;#39;search engine&amp;#39; into our app (this was not an actual search engine, more like a hunt path engine).&amp;nbsp; When I first started out writing code I started out by creating all these classes and logic that I thought I would need.&amp;nbsp; After about 3-4 hours of coding I was dead in the water.&amp;nbsp; I was not able to solve my problem in a simple manner and I was frustrated.&amp;nbsp; I decided to take a step back and start over.&amp;nbsp; &lt;/p&gt; &lt;p&gt;This time though I&amp;nbsp;started out by writing test to mimic what I actually needed.&amp;nbsp; I continued to follow the principles of &lt;a href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank"&gt;TDD&lt;/a&gt; (btw, TDD is more then just about writing tests), within an hour or so I had my solution pretty much good to go.&amp;nbsp; All those classes and methods I THOUGHT I would need I did NOT.&amp;nbsp; I was able to scrap about 50% of the code/classes that I thought I needed.&amp;nbsp; And guess what, now I have a test suit to test my new code.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows ME to find more bugs during the development process&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;It has been my experience that I find more bugs while writing tests.&amp;nbsp; This is due to the fact that I not only follow TDD, but I also do my best to implement the &lt;a href="http://en.wikipedia.org/wiki/Fail-fast" target="_blank"&gt;Fail Fast Principle&lt;/a&gt;.&amp;nbsp; When I am writing my tests I have the ability to create tests that easily walk though the different pathways of my code (I attempt to hit 100% code coverage as well).&amp;nbsp; If I were not writing tests I would have to do this via the application, and&amp;nbsp;this is much more painful and it less likely that I would actually do it.&lt;/p&gt; &lt;p&gt;By writing my tests and testing my code during the development process I know that I have reduced my bug count significantly.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Makes ME feel more comfortable making changes&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This is the beauty of TDD, I am not afraid to make any critical changes to my code because I KNOW that I have tests to verify if I screwed anything up.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Have you ever run across some code that &amp;#39;you were scared&amp;#39; to change?&amp;nbsp; If you had tests for that code I bet you would a WHOLE LOT LESS scared to make any changes.&amp;nbsp; I know that I am.&lt;/p&gt; &lt;p&gt;A case in point for this is as follows.&amp;nbsp; On a prior project a consultant I was working with needed to make changes to some &amp;#39;smelly&amp;#39; logic.&amp;nbsp; This just happened to be a week or so before a scheduled release.&amp;nbsp; Beacuse he had NO confidence that the changes he would make would NOT break the application, he convinced the business to NOT make the changes. &amp;nbsp;I bet you a dollar that had there been unit tests he would have been much more willing to make the changes.&amp;nbsp; In this case the fact of NOT having tests may have caused the business to lose out on features it needed.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Improves MY code&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Because following TDD practices&amp;nbsp;forces you to write your failing code before your passing code,&amp;nbsp;I tend to implement my intent much cleaner and simpler.&amp;nbsp; I also know that because I am writing tests along the way my code is solid.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows ME to better convey intent&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I know that tests are not a&amp;nbsp;substitution for&amp;nbsp;quality comments that convey intent, but they sure are the next best thing.&amp;nbsp; It is really nice to be able to point someone towards a suite of tests to &amp;#39;demo&amp;#39; how to use a component.&lt;/p&gt; &lt;p&gt;A case in point for this is as follows.&amp;nbsp; A few weeks ago at work I wrote an API to allow the querying of some data via our imaging system at work.&amp;nbsp; Turns out that an outside party needed to use this API for integration into on of our 3rd party applications.&amp;nbsp; When he came to me asking for &amp;#39;how do I use this&amp;#39;, I simply emailed him my suite of tests.&amp;nbsp; In this suite I had pretty much any conceivable use for the API.&amp;nbsp; To date the vendor has not asked me how to implement the API.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows MY tests to be automated and rerunable&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This is a nice side effect of having tests.&amp;nbsp; Because we use&amp;nbsp;both NUnit and CruiseControl I can run my tests on every check in.&amp;nbsp; This is cool because now I (and the team) know if changes&amp;nbsp;I made&amp;nbsp;breaks some other part of the system.&amp;nbsp; I would rather know now then before QA hits it.&amp;nbsp; &lt;/p&gt; &lt;p&gt;The above are simply my opinion, if you don&amp;#39;t share the same opinions, let me know.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38554" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>Fail Fast Principle</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/06/08/fail-fast-principle.aspx</link><pubDate>Fri, 08 Jun 2007 18:08:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:27991</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=27991</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=27991</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/06/08/fail-fast-principle.aspx#comments</comments><description>I am thinking about posting about different principles/patterns over the next few weeks/months. I have decided to start with Fail Fast. This is something that I think most people over look or plain just don't do. Although the concept of Fail Fast is easy...(&lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/06/08/fail-fast-principle.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://devlicio.us/aggbug.aspx?PostID=27991" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Technical Debt, How we accumulate it, and how we can reduce it</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/05/25/technical-debt-how-we-accumulate-it-and-how-we-can-reduce-it.aspx</link><pubDate>Fri, 25 May 2007 14:03:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:26432</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=26432</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=26432</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/05/25/technical-debt-how-we-accumulate-it-and-how-we-can-reduce-it.aspx#comments</comments><description>All software projects will amass some amount of technical debt. This is not a necessarily bad thing; it is just he cost of doing business. As developers the only thing we can do is try to control/limit the amount of technical debt we build up. If you...(&lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/05/25/technical-debt-how-we-accumulate-it-and-how-we-can-reduce-it.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://devlicio.us/aggbug.aspx?PostID=26432" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category></item><item><title>Learning to use Mocks and the power they provide</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/05/23/learning-to-use-mocks-and-the-power-they-provide.aspx</link><pubDate>Wed, 23 May 2007 11:54:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:26297</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=26297</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=26297</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/05/23/learning-to-use-mocks-and-the-power-they-provide.aspx#comments</comments><description>Up until a few months ago I had never even attempted to use mocks ( NMock , RhinoMock , etc). Every time I would read about Mocking I thought to myself, this is kinda cool, but seems to be a waste of energy. At the time I saw Mocks as only a way to create...(&lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/05/23/learning-to-use-mocks-and-the-power-they-provide.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://devlicio.us/aggbug.aspx?PostID=26297" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category></item><item><title> Raising Events in NMock 2.0</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/04/17/raising-events-in-nmock-2-0.aspx</link><pubDate>Tue, 17 Apr 2007 14:42:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:22039</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=22039</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=22039</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/04/17/raising-events-in-nmock-2-0.aspx#comments</comments><description>&lt;p&gt;Just to pass this along.&amp;nbsp; I was needing to raise events in NMock and I came across this post on how to &lt;a href="http://becomingagile.blogspot.com/2007/03/raising-events-in-nmock-20.html" target="_blank"&gt;Raise Events in NMock2&lt;/a&gt;.&amp;nbsp; This is a good post with clear examples.&lt;/p&gt;&lt;p&gt;Enjoy&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=22039" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/NMock/default.aspx">NMock</category></item><item><title>Options Wanted: How do I handle my Mocks</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/04/17/options-wanted-how-do-i-handle-my-mocks.aspx</link><pubDate>Tue, 17 Apr 2007 12:35:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:22024</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=22024</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=22024</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/04/17/options-wanted-how-do-i-handle-my-mocks.aspx#comments</comments><description>
&lt;p&gt;I am looking for feedback from the group.&amp;nbsp; I am pretty new to using
mocks for my unit tests and I am not sure what the standard approach in the
community for usage of mocks in regards to how/where they are stored in your
test application.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p&gt;After refactoring some of my tests to use mocks I quickly noticed that I was
littering the same mock creation code in many of the unit tests.&amp;nbsp; So, the
first thing I did was create a local helper method inside my test. However, as
I continued my refactoring I was started to create the same helper method in
many classes.&amp;nbsp; After noticing what I was doing, I knew there had to be a
better way to do this.&lt;br&gt;
&lt;br&gt;
What I am thinking of doing is creating a ‘Mocks project’ that will only
contain static methods that can be called (with and without construction params)
to build and return a mock for a given interface. &lt;span&gt;&amp;nbsp;&lt;/span&gt;The reason I want separate class for this is
because 2 different projects use the same backend, but each have their own test
suite.&lt;/p&gt;

&lt;p&gt;Does this sound absurd?&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Thanks for any insight.&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=22024" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/NMock/default.aspx">NMock</category></item></channel></rss>