<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>.Hibri - TDD</title>
    <link>http://www.hibri.net/</link>
    <description>Thoughts on the craft of building software</description>
    <language>en-gb</language>
    <copyright>Hibri Marzook</copyright>
    <lastBuildDate>Mon, 17 May 2010 21:00:42 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>hibri@hibri.net</managingEditor>
    <webMaster>hibri@hibri.net</webMaster>
    <item>
      <trackback:ping>http://www.hibri.net/Trackback.aspx?guid=2d77debe-518d-4533-8175-339546de688d</trackback:ping>
      <pingback:server>http://www.hibri.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.hibri.net/PermaLink,guid,2d77debe-518d-4533-8175-339546de688d.aspx</pingback:target>
      <dc:creator>Hibri</dc:creator>
      <wfw:comment>http://www.hibri.net/CommentView,guid,2d77debe-518d-4533-8175-339546de688d.aspx</wfw:comment>
      <wfw:commentRss>http://www.hibri.net/SyndicationService.asmx/GetEntryCommentsRss?guid=2d77debe-518d-4533-8175-339546de688d</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There comes a time during every project, when someone in the team asks the question
“What is our branching strategy? “. Off we go trying to find out what is the current
branching best practice, what are other teams using ? , What is the Agile way ? We
may find solutions in <a href="http://martinfowler.com/bliki/FeatureBranch.html" target="_blank">feature
branching</a>, per story branches, <a href="http://svnbook.red-bean.com/en/1.5/svn.branchmerge.commonpatterns.html" target="_blank">release
branches</a> and so on.
</p>
        <p>
Let’s take a step back. Why do we need a branching strategy ? What is a branch ?
</p>
        <p>
We want to put some code in a source control branch, because the code contains the
risk of breaking the software in the mainline of development, trunk. 
</p>
        <p>
Are we 100% sure that the code in the branch won’t break what is in trunk ? We won’t
know for sure till we integrate the branch with trunk.  We won’t know, until
it goes through automated/manual testing, and all this after going through merge hell.
</p>
        <p>
We put code in a branch to reduce risk. However, we haven’t reduced that risk. The
risk is still there, and we bring it back into trunk. Why not look at methods of reducing
the risk in the first place ? 
</p>
        <p>
How do we reduce risk ?
</p>
        <p>
          <strong>1. Cut up a big piece of risk into smaller pieces of risk.</strong>
        </p>
        <p>
The bigger the risk the more chopping it needs. Now we have smaller things to work
on. We do those small pieces one by one, and if something breaks, we know which change
broke it. Easier to fix because it was a small change. 
</p>
        <p>
          <strong>2. Break down a big piece of risk, into parts that have no risk and parts
that have risk.</strong>
        </p>
        <p>
Analyze the problem, break it out in to parts that can be done without breaking our
software. This is interesting. The part which we thought would be a problem might
have become a non-issue. We’ve isolated it. We know exactly which change will break
our software. See 1 above
</p>
        <p>
          <strong>3. Write tests for things that can be broken by the risky bit of code and
continuously test.</strong>
        </p>
        <p>
We know what could break, by the new change. Before we make the change, let’s write
tests for our software so we know when it is broken.  Let’s make a change. Is
anything broken ? No. Did the next change break it ? yes. Fix it. Keep going.
</p>
        <p>
Instead of shoving off our risky code into a branch, we’ve learnt to manage the risk,
and reduce it. If the risk is so high that we can’t mitigate it by doing 1,2 and 3,
then let’s create a branch for the code. We have a branching strategy based on risk.
We create a branch only for code that is riskiest, and we haven’t been able to reduce
that risk by a divide and conquer approach.
</p>
        <p>
In my opinion this is a much better way than having a default branching strategy for
every piece of work/story/feature/MMF. Working continuously on trunk has benefits.
We can release a feature faster, get refactoring changes others have made quicker.
Not go through merge hell, and risk loosing code in the process. Along the way we’ve
learnt how to break up a problem into smaller pieces. We’ve got better at writing
tests. We’ve learnt how to structure our software so that one thing does not break
everything else and we get closer to the nirvana of <a href="http://toni.org/2010/05/19/in-praise-of-continuous-deployment-the-wordpress-com-story/" target="_blank">continuous
deployment</a>, because we have only one production line of code to deploy from.
</p>
        <p>
Do you need a branching strategy ? Think again.
</p>
        <p>
 
</p>
        <p>
 
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f6aa0a36-a879-49f6-afe1-ead4480d5b94" class="wlWriterSmartContent">del.icio.us
Tags: <a href="http://del.icio.us/popular/%22branching+strategies%22" rel="tag">"branching
strategies"</a>,<a href="http://del.icio.us/popular/%22agile+branching%22" rel="tag">"agile
branching"</a>,<a href="http://del.icio.us/popular/branching" rel="tag">branching</a></div>
      </body>
      <title>Thoughts on branching strategies.</title>
      <guid isPermaLink="false">http://www.hibri.net/PermaLink,guid,2d77debe-518d-4533-8175-339546de688d.aspx</guid>
      <link>http://www.hibri.net/2010/05/17/ThoughtsOnBranchingStrategies.aspx</link>
      <pubDate>Mon, 17 May 2010 21:00:42 GMT</pubDate>
      <description>&lt;p&gt;
There comes a time during every project, when someone in the team asks the question
“What is our branching strategy? “. Off we go trying to find out what is the current
branching best practice, what are other teams using ? , What is the Agile way ? We
may find solutions in &lt;a href="http://martinfowler.com/bliki/FeatureBranch.html" target="_blank"&gt;feature
branching&lt;/a&gt;, per story branches, &lt;a href="http://svnbook.red-bean.com/en/1.5/svn.branchmerge.commonpatterns.html" target="_blank"&gt;release
branches&lt;/a&gt; and so on.
&lt;/p&gt;
&lt;p&gt;
Let’s take a step back. Why do we need a branching strategy ? What is a branch ?
&lt;/p&gt;
&lt;p&gt;
We want to put some code in a source control branch, because the code contains the
risk of breaking the software in the mainline of development, trunk. 
&lt;/p&gt;
&lt;p&gt;
Are we 100% sure that the code in the branch won’t break what is in trunk ? We won’t
know for sure till we integrate the branch with trunk.&amp;#160; We won’t know, until
it goes through automated/manual testing, and all this after going through merge hell.
&lt;/p&gt;
&lt;p&gt;
We put code in a branch to reduce risk. However, we haven’t reduced that risk. The
risk is still there, and we bring it back into trunk. Why not look at methods of reducing
the risk in the first place ? 
&lt;/p&gt;
&lt;p&gt;
How do we reduce risk ?
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;1. Cut up a big piece of risk into smaller pieces of risk.&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
The bigger the risk the more chopping it needs. Now we have smaller things to work
on. We do those small pieces one by one, and if something breaks, we know which change
broke it. Easier to fix because it was a small change. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;2. Break down a big piece of risk, into parts that have no risk and parts
that have risk.&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
Analyze the problem, break it out in to parts that can be done without breaking our
software. This is interesting. The part which we thought would be a problem might
have become a non-issue. We’ve isolated it. We know exactly which change will break
our software. See 1 above
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;3. Write tests for things that can be broken by the risky bit of code and
continuously test.&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
We know what could break, by the new change. Before we make the change, let’s write
tests for our software so we know when it is broken.&amp;#160; Let’s make a change. Is
anything broken ? No. Did the next change break it ? yes. Fix it. Keep going.
&lt;/p&gt;
&lt;p&gt;
Instead of shoving off our risky code into a branch, we’ve learnt to manage the risk,
and reduce it. If the risk is so high that we can’t mitigate it by doing 1,2 and 3,
then let’s create a branch for the code. We have a branching strategy based on risk.
We create a branch only for code that is riskiest, and we haven’t been able to reduce
that risk by a divide and conquer approach.
&lt;/p&gt;
&lt;p&gt;
In my opinion this is a much better way than having a default branching strategy for
every piece of work/story/feature/MMF. Working continuously on trunk has benefits.
We can release a feature faster, get refactoring changes others have made quicker.
Not go through merge hell, and risk loosing code in the process. Along the way we’ve
learnt how to break up a problem into smaller pieces. We’ve got better at writing
tests. We’ve learnt how to structure our software so that one thing does not break
everything else and we get closer to the nirvana of &lt;a href="http://toni.org/2010/05/19/in-praise-of-continuous-deployment-the-wordpress-com-story/" target="_blank"&gt;continuous
deployment&lt;/a&gt;, because we have only one production line of code to deploy from.
&lt;/p&gt;
&lt;p&gt;
Do you need a branching strategy ? Think again.
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f6aa0a36-a879-49f6-afe1-ead4480d5b94" class="wlWriterSmartContent"&gt;del.icio.us
Tags: &lt;a href="http://del.icio.us/popular/%22branching+strategies%22" rel="tag"&gt;&amp;quot;branching
strategies&amp;quot;&lt;/a&gt;,&lt;a href="http://del.icio.us/popular/%22agile+branching%22" rel="tag"&gt;&amp;quot;agile
branching&amp;quot;&lt;/a&gt;,&lt;a href="http://del.icio.us/popular/branching" rel="tag"&gt;branching&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.hibri.net/CommentView,guid,2d77debe-518d-4533-8175-339546de688d.aspx</comments>
      <category>Agile</category>
      <category>development</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://www.hibri.net/Trackback.aspx?guid=10aba050-9562-4f91-846b-e2e78ccc46ee</trackback:ping>
      <pingback:server>http://www.hibri.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.hibri.net/PermaLink,guid,10aba050-9562-4f91-846b-e2e78ccc46ee.aspx</pingback:target>
      <dc:creator>Hibri</dc:creator>
      <wfw:comment>http://www.hibri.net/CommentView,guid,10aba050-9562-4f91-846b-e2e78ccc46ee.aspx</wfw:comment>
      <wfw:commentRss>http://www.hibri.net/SyndicationService.asmx/GetEntryCommentsRss?guid=10aba050-9562-4f91-846b-e2e78ccc46ee</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The major highlight at XP Day 2009, was <a href="http://gojko.net/2009/12/07/improving-testing-practices-at-google/" target="_blank">Mark
Striebeck’s talk on unit testing practices at Google</a>.  What makes a good
test depends on experience , skill and school of thought. I had to agree when he said
that developers can be almost religious when it comes to the topic of what makes a
good test. This made them solve this problem the Google way, by gathering data. Let
the data speak. 
</p>
        <p>
He went on to describe metrics that they were collecting on tests and test code. 
A test that has never failed is likely to be a bad test. If the test was fixed to
make the test pass, then this is also an attribute of a bad test. A test can be a
good test if the code was fixed to make the test pass.
</p>
        <p>
This got me thinking. Generally I haven’t gathered metrics on test code. We have a
pretty good <a href="http://blog.robbowley.net/2009/10/28/visualising-the-internal-quality-of-software-part-1/" target="_blank">metrics
dashboard</a> for production code. What metrics can I gather on test code ? 
</p>
        <p>
Metrics on test code should also focus on the readability of the code. Having large
test methods is ok, but not too big. My opinion is that a test method with more than
20 lines is too big. 
</p>
        <p>
Tests should be concise, the assert should be obvious. Some code duplication is fine
to make the test readable. This is all fine, but how can I get these as metrics 
? Only way to judge this is to eyeball the tests, and there are differences of opinion. 
</p>
        <p>
However, there are ways to measure what a test should not be. These are test smells.
Test smells are described in <a href="http://www.amazon.co.uk/gp/product/0131495054?ie=UTF8&amp;tag=hibrinet-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0131495054" target="_blank">xUnit
Test Patterns</a></p>
        <p>
I’ve listed a few test smells and <a href="http://www.ndepend.com/Metrics.aspx" target="_blank">NDepend
CQL queries</a> find these smells. These can be automated in the build process and
flagged up.
</p>
        <p>
          <strong>Large Test Methods</strong>
        </p>
        <p>
These can be a chore to read. Tests should be written as simply as possible. These
also  point to too many responsibilities and dependencies in the code being tested,
as most of the test code is used to do setup for the test.
</p>
        <p>
          <em>SELECT METHODS WHERE HasAttribute "NUnit.Framework.TestAttribute" AND 
NbLinesOfCode &gt; 20</em>
        </p>
        <p>
          <strong>Large setup methods</strong>
        </p>
        <p>
Usually when unit testing the same code, we tend to have a common setup method, in
order to make the test more readable. What happens is, more and more code is moved
into the common setup method. We get blind to this after a while, and all the dependencies
for the test are hidden away. If you do have [Setup] methods, keep them small.
</p>
        <p>
          <em>SELECT METHODS WHERE HasAttribute "NUnit.Framework.SetUpAttribute" AND
NbLinesOfCode  &gt; 10</em>
        </p>
        <p>
          <strong>Deep inheritance trees in test fixtures</strong>
        </p>
        <p>
Again, common test code moved up to a base class and the base class is used in many
tests. Then more base classes are created. This creates more tight coupling between
test classes. Which makes tests harder to change. Low coupling and high cohesion applies
to test code as well. Make each unit test class as independent as possible.
</p>
        <p>
          <em>SELECT TYPES WHERE HasAttribute "NUnit.Framework.TestFixtureAttribute" 
AND DepthOfInheritance &gt;2</em>
        </p>
        <p>
          <strong>Test fixture setup</strong>
        </p>
        <p>
TestFixtureSetup is bad. The <a href="http://www.nunit.org/index.php?p=fixtureSetup&amp;r=2.2.10" target="_blank">TestFixtureSetup</a> is
run once before all tests. This leads to fragile tests and inadvertently leads to
using some shared state. Use Setup instead
</p>
        <p>
          <em>SELECT METHODS WHERE HasAttribute "NUnit.Framework.TestFixtureSetUpAttribute"</em>
        </p>
        <p>
          <strong>Tests that fail when they are run in a different order</strong>
        </p>
        <p>
The <a href="http://xunit.codeplex.com/wikipage?title=Comparisons&amp;referringTitle=Home" target="_blank">xUnit</a> test
runner helps with this, by randomizing the order tests are run.
</p>
        <p>
          <strong>Ignored tests</strong>
        </p>
        <p>
Ignored tests are like comments. Dead code that doesn’t do anything. Either fix them
or delete them.
</p>
        <p>
I have yet to find some way of detecting duplicated tests, shared state in tests and
multiple asserts in tests. What other ways can I find test smells ? 
</p>
      </body>
      <title>Test Smells and Test Code Quality Metrics</title>
      <guid isPermaLink="false">http://www.hibri.net/PermaLink,guid,10aba050-9562-4f91-846b-e2e78ccc46ee.aspx</guid>
      <link>http://www.hibri.net/2009/12/09/TestSmellsAndTestCodeQualityMetrics.aspx</link>
      <pubDate>Wed, 09 Dec 2009 22:15:58 GMT</pubDate>
      <description>&lt;p&gt;
The major highlight at XP Day 2009, was &lt;a href="http://gojko.net/2009/12/07/improving-testing-practices-at-google/" target="_blank"&gt;Mark
Striebeck’s talk on unit testing practices at Google&lt;/a&gt;.&amp;#160; What makes a good
test depends on experience , skill and school of thought. I had to agree when he said
that developers can be almost religious when it comes to the topic of what makes a
good test. This made them solve this problem the Google way, by gathering data. Let
the data speak. 
&lt;/p&gt;
&lt;p&gt;
He went on to describe metrics that they were collecting on tests and test code.&amp;#160;
A test that has never failed is likely to be a bad test. If the test was fixed to
make the test pass, then this is also an attribute of a bad test. A test can be a
good test if the code was fixed to make the test pass.
&lt;/p&gt;
&lt;p&gt;
This got me thinking. Generally I haven’t gathered metrics on test code. We have a
pretty good &lt;a href="http://blog.robbowley.net/2009/10/28/visualising-the-internal-quality-of-software-part-1/" target="_blank"&gt;metrics
dashboard&lt;/a&gt; for production code. What metrics can I gather on test code ? 
&lt;/p&gt;
&lt;p&gt;
Metrics on test code should also focus on the readability of the code. Having large
test methods is ok, but not too big. My opinion is that a test method with more than
20 lines is too big. 
&lt;/p&gt;
&lt;p&gt;
Tests should be concise, the assert should be obvious. Some code duplication is fine
to make the test readable. This is all fine, but how can I get these as metrics&amp;#160;
? Only way to judge this is to eyeball the tests, and there are differences of opinion. 
&lt;/p&gt;
&lt;p&gt;
However, there are ways to measure what a test should not be. These are test smells.
Test smells are described in &lt;a href="http://www.amazon.co.uk/gp/product/0131495054?ie=UTF8&amp;amp;tag=hibrinet-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=0131495054" target="_blank"&gt;xUnit
Test Patterns&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
I’ve listed a few test smells and &lt;a href="http://www.ndepend.com/Metrics.aspx" target="_blank"&gt;NDepend
CQL queries&lt;/a&gt; find these smells. These can be automated in the build process and
flagged up.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Large Test Methods&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
These can be a chore to read. Tests should be written as simply as possible. These
also&amp;#160; point to too many responsibilities and dependencies in the code being tested,
as most of the test code is used to do setup for the test.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;SELECT METHODS WHERE HasAttribute &amp;quot;NUnit.Framework.TestAttribute&amp;quot; AND&amp;#160;
NbLinesOfCode &amp;gt; 20&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Large setup methods&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Usually when unit testing the same code, we tend to have a common setup method, in
order to make the test more readable. What happens is, more and more code is moved
into the common setup method. We get blind to this after a while, and all the dependencies
for the test are hidden away. If you do have [Setup] methods, keep them small.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;SELECT METHODS WHERE HasAttribute &amp;quot;NUnit.Framework.SetUpAttribute&amp;quot; AND
NbLinesOfCode&amp;#160; &amp;gt; 10&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Deep inheritance trees in test fixtures&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Again, common test code moved up to a base class and the base class is used in many
tests. Then more base classes are created. This creates more tight coupling between
test classes. Which makes tests harder to change. Low coupling and high cohesion applies
to test code as well. Make each unit test class as independent as possible.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;SELECT TYPES WHERE HasAttribute &amp;quot;NUnit.Framework.TestFixtureAttribute&amp;quot;&amp;#160;
AND DepthOfInheritance &amp;gt;2&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Test fixture setup&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
TestFixtureSetup is bad. The &lt;a href="http://www.nunit.org/index.php?p=fixtureSetup&amp;amp;r=2.2.10" target="_blank"&gt;TestFixtureSetup&lt;/a&gt; is
run once before all tests. This leads to fragile tests and inadvertently leads to
using some shared state. Use Setup instead
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;SELECT METHODS WHERE HasAttribute &amp;quot;NUnit.Framework.TestFixtureSetUpAttribute&amp;quot;&lt;/em&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Tests that fail when they are run in a different order&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The &lt;a href="http://xunit.codeplex.com/wikipage?title=Comparisons&amp;amp;referringTitle=Home" target="_blank"&gt;xUnit&lt;/a&gt; test
runner helps with this, by randomizing the order tests are run.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Ignored tests&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Ignored tests are like comments. Dead code that doesn’t do anything. Either fix them
or delete them.
&lt;/p&gt;
&lt;p&gt;
I have yet to find some way of detecting duplicated tests, shared state in tests and
multiple asserts in tests. What other ways can I find test smells ? 
&lt;/p&gt;</description>
      <comments>http://www.hibri.net/CommentView,guid,10aba050-9562-4f91-846b-e2e78ccc46ee.aspx</comments>
      <category>Agile</category>
      <category>development</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://www.hibri.net/Trackback.aspx?guid=64d23b3c-0a4e-47e2-b83f-e022f4abdf8c</trackback:ping>
      <pingback:server>http://www.hibri.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.hibri.net/PermaLink,guid,64d23b3c-0a4e-47e2-b83f-e022f4abdf8c.aspx</pingback:target>
      <dc:creator>Hibri</dc:creator>
      <wfw:comment>http://www.hibri.net/CommentView,guid,64d23b3c-0a4e-47e2-b83f-e022f4abdf8c.aspx</wfw:comment>
      <wfw:commentRss>http://www.hibri.net/SyndicationService.asmx/GetEntryCommentsRss?guid=64d23b3c-0a4e-47e2-b83f-e022f4abdf8c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
 
</p>
        <p>
When you are in the zone, and want to add a reference to Rhino, NUnit or any other
common reference, adding it via the Add Reference dialog can be painfully slow. Fortunately
VS has a good automation interface, which lets you to write macros.
</p>
        <p>
I wrote a simple macro to add a NUnit reference to the current project. Add this to
your Macros project in Visual Studio, map a button or a shortcut key to it. This way
you can add those common references pretty quick. 
</p>
        <p>
This is a cleaned up version of the sample here <a title="http://msdn.microsoft.com/en-us/library/vslangproj80.reference3%28VS.80%29.aspx" href="http://msdn.microsoft.com/en-us/library/vslangproj80.reference3%28VS.80%29.aspx">http://msdn.microsoft.com/en-us/library/vslangproj80.reference3%28VS.80%29.aspx</a></p>
        <p>
 
</p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>
            <span class="kwrd">Sub</span> AddNUnitReference()</pre>
          <pre>
            <span class="lnum"> 2: </span> AddNewReference(DTE, <span class="str">"C:\Tools\NUnit\nunit.framework.dll"</span>)</pre>
          <pre>
            <span class="lnum"> 3: </span>
            <span class="kwrd">End</span>
            <span class="kwrd">Sub</span>
          </pre>
          <pre>
            <span class="lnum"> 4: </span> </pre>
          <pre>
            <span class="lnum"> 5: </span>
            <span class="kwrd">Sub</span> AddNewReference(<span class="kwrd">ByVal</span> dte <span class="kwrd">As</span> DTE2, <span class="kwrd">ByVal</span> referencePath <span class="kwrd">As</span><span class="kwrd">String</span>)</pre>
          <pre>
            <span class="lnum"> 6: </span>
            <span class="kwrd">Dim</span> aProject <span class="kwrd">As</span> Project</pre>
          <pre>
            <span class="lnum"> 7: </span>
            <span class="kwrd">Dim</span> aVSProject <span class="kwrd">As</span> VSProject</pre>
          <pre>
            <span class="lnum"> 8: </span> </pre>
          <pre>
            <span class="lnum"> 9: </span> aProject = dte.ActiveDocument.ProjectItem.ContainingProject</pre>
          <pre>
            <span class="lnum"> 10: </span> </pre>
          <pre>
            <span class="lnum"> 11: </span> aVSProject = <span class="kwrd">CType</span>(dte.ActiveDocument.ProjectItem.ContainingProject.<span class="kwrd">Object</span>,
VSProject)</pre>
          <pre>
            <span class="lnum"> 12: </span>
            <span class="rem">' Add an Assembly reference
and display its type and additional</span>
          </pre>
          <pre>
            <span class="lnum"> 13: </span>
            <span class="rem">' information.</span>
          </pre>
          <pre>
            <span class="lnum"> 14: </span>
            <span class="kwrd">Dim</span> newRef <span class="kwrd">As</span> Reference</pre>
          <pre>
            <span class="lnum"> 15: </span> newRef = aVSProject.References.Add(referencePath)</pre>
          <pre>
            <span class="lnum"> 16: </span> </pre>
          <pre>
            <span class="lnum"> 17: </span>
            <span class="kwrd">End</span> Sub</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
      </body>
      <title>Avoid the slow Add Reference dialog box in Visual Studio 2008</title>
      <guid isPermaLink="false">http://www.hibri.net/PermaLink,guid,64d23b3c-0a4e-47e2-b83f-e022f4abdf8c.aspx</guid>
      <link>http://www.hibri.net/2009/11/28/AvoidTheSlowAddReferenceDialogBoxInVisualStudio2008.aspx</link>
      <pubDate>Sat, 28 Nov 2009 13:31:31 GMT</pubDate>
      <description>&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
When you are in the zone, and want to add a reference to Rhino, NUnit or any other
common reference, adding it via the Add Reference dialog can be painfully slow. Fortunately
VS has a good automation interface, which lets you to write macros.
&lt;/p&gt;
&lt;p&gt;
I wrote a simple macro to add a NUnit reference to the current project. Add this to
your Macros project in Visual Studio, map a button or a shortcut key to it. This way
you can add those common references pretty quick. 
&lt;/p&gt;
&lt;p&gt;
This is a cleaned up version of the sample here &lt;a title="http://msdn.microsoft.com/en-us/library/vslangproj80.reference3%28VS.80%29.aspx" href="http://msdn.microsoft.com/en-us/library/vslangproj80.reference3%28VS.80%29.aspx"&gt;http://msdn.microsoft.com/en-us/library/vslangproj80.reference3%28VS.80%29.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt; AddNUnitReference()&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt; AddNewReference(DTE, &lt;span class="str"&gt;&amp;quot;C:\Tools\NUnit\nunit.framework.dll&amp;quot;&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt; &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt; AddNewReference(&lt;span class="kwrd"&gt;ByVal&lt;/span&gt; dte &lt;span class="kwrd"&gt;As&lt;/span&gt; DTE2, &lt;span class="kwrd"&gt;ByVal&lt;/span&gt; referencePath &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;String&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; &lt;span class="kwrd"&gt;Dim&lt;/span&gt; aProject &lt;span class="kwrd"&gt;As&lt;/span&gt; Project&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt; &lt;span class="kwrd"&gt;Dim&lt;/span&gt; aVSProject &lt;span class="kwrd"&gt;As&lt;/span&gt; VSProject&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt; aProject = dte.ActiveDocument.ProjectItem.ContainingProject&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; aVSProject = &lt;span class="kwrd"&gt;CType&lt;/span&gt;(dte.ActiveDocument.ProjectItem.ContainingProject.&lt;span class="kwrd"&gt;Object&lt;/span&gt;,
VSProject)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt; &lt;span class="rem"&gt;' Add an Assembly reference
and display its type and additional&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt; &lt;span class="rem"&gt;' information.&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt; &lt;span class="kwrd"&gt;Dim&lt;/span&gt; newRef &lt;span class="kwrd"&gt;As&lt;/span&gt; Reference&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 15: &lt;/span&gt; newRef = aVSProject.References.Add(referencePath)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 16: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 17: &lt;/span&gt; &lt;span class="kwrd"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;</description>
      <comments>http://www.hibri.net/CommentView,guid,64d23b3c-0a4e-47e2-b83f-e022f4abdf8c.aspx</comments>
      <category>.Net General</category>
      <category>development</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://www.hibri.net/Trackback.aspx?guid=7e824729-64c9-4ba6-94f5-4359806b63ce</trackback:ping>
      <pingback:server>http://www.hibri.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.hibri.net/PermaLink,guid,7e824729-64c9-4ba6-94f5-4359806b63ce.aspx</pingback:target>
      <dc:creator>Hibri</dc:creator>
      <wfw:comment>http://www.hibri.net/CommentView,guid,7e824729-64c9-4ba6-94f5-4359806b63ce.aspx</wfw:comment>
      <wfw:commentRss>http://www.hibri.net/SyndicationService.asmx/GetEntryCommentsRss?guid=7e824729-64c9-4ba6-94f5-4359806b63ce</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I like the idea of running unit tests continuously as I type and save code. 
I read
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:742324d9-c55a-49e3-ad59-bf71b7bfba50" class="wlWriterEditableSmartContent">Technorati
Tags: <a href="http://technorati.com/tags/TDD" rel="tag">TDD</a></div>
        <p>
about <a href="http://timross.wordpress.com/2009/08/04/continuous-testing-in-net/">Autobuild
.Net</a> recently. This is easy to setup and use.
</p>
        <p>
Grab the  code from <a title="http://code.google.com/p/autobuildtool/" href="http://code.google.com/p/autobuildtool/">http://code.google.com/p/autobuildtool/</a> 
build it by running the default.build script.
</p>
        <p>
When this is built successfully, the build process creates the tool in the output
directory.
</p>
        <p>
Copy the contents of this output directory to the project where you want autobuild
to work on.
</p>
        <p>
Autobuild .Net runs a nant build script each time a file is saved in a specific path
being watched.
</p>
        <p>
Change the autobuild.build script with the path to the solution file and the path
to the unit test assembly.
</p>
        <p>
Next in autobuild.cmd , change the first argument to the directory to watch for changes.
The second argument is for the path to autobuild.build. This is the nant build script
that autobuild will execute. You can replace this with an existing Nant build script.
</p>
        <p>
Run atuobuild.cmd . That's it. Type some code, save it and watch the window go red
because it didn’t compile. Make it compile and watch it go green.
</p>
        <p>
Write a failing test and see it go red, make it pass and see it go green. Fun eh ?
:)
</p>
      </body>
      <title>Continuous TDD with Autobuild .Net</title>
      <guid isPermaLink="false">http://www.hibri.net/PermaLink,guid,7e824729-64c9-4ba6-94f5-4359806b63ce.aspx</guid>
      <link>http://www.hibri.net/2009/08/27/ContinuousTDDWithAutobuildNet.aspx</link>
      <pubDate>Thu, 27 Aug 2009 13:53:40 GMT</pubDate>
      <description>&lt;p&gt;
I like the idea of running unit tests continuously as I type and save code.&amp;#160;
I read
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:742324d9-c55a-49e3-ad59-bf71b7bfba50" class="wlWriterEditableSmartContent"&gt;Technorati
Tags: &lt;a href="http://technorati.com/tags/TDD" rel="tag"&gt;TDD&lt;/a&gt;
&lt;/div&gt;
&lt;p&gt;
about &lt;a href="http://timross.wordpress.com/2009/08/04/continuous-testing-in-net/"&gt;Autobuild
.Net&lt;/a&gt; recently. This is easy to setup and use.
&lt;/p&gt;
&lt;p&gt;
Grab the&amp;#160; code from &lt;a title="http://code.google.com/p/autobuildtool/" href="http://code.google.com/p/autobuildtool/"&gt;http://code.google.com/p/autobuildtool/&lt;/a&gt;&amp;#160;
build it by running the default.build script.
&lt;/p&gt;
&lt;p&gt;
When this is built successfully, the build process creates the tool in the output
directory.
&lt;/p&gt;
&lt;p&gt;
Copy the contents of this output directory to the project where you want autobuild
to work on.
&lt;/p&gt;
&lt;p&gt;
Autobuild .Net runs a nant build script each time a file is saved in a specific path
being watched.
&lt;/p&gt;
&lt;p&gt;
Change the autobuild.build script with the path to the solution file and the path
to the unit test assembly.
&lt;/p&gt;
&lt;p&gt;
Next in autobuild.cmd , change the first argument to the directory to watch for changes.
The second argument is for the path to autobuild.build. This is the nant build script
that autobuild will execute. You can replace this with an existing Nant build script.
&lt;/p&gt;
&lt;p&gt;
Run atuobuild.cmd . That's it. Type some code, save it and watch the window go red
because it didn’t compile. Make it compile and watch it go green.
&lt;/p&gt;
&lt;p&gt;
Write a failing test and see it go red, make it pass and see it go green. Fun eh ?
:)
&lt;/p&gt;</description>
      <comments>http://www.hibri.net/CommentView,guid,7e824729-64c9-4ba6-94f5-4359806b63ce.aspx</comments>
      <category>Agile</category>
      <category>TDD</category>
    </item>
  </channel>
</rss>