<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Including Tests into the Original Assembly</title>
	<atom:link href="http://elegantcode.com/2007/07/22/including-tests-into-the-original-assembly/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2007/07/22/including-tests-into-the-original-assembly/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=including-tests-into-the-original-assembly</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Tom St. Clair</title>
		<link>http://elegantcode.com/2007/07/22/including-tests-into-the-original-assembly/comment-page-1/#comment-5934</link>
		<dc:creator>Tom St. Clair</dc:creator>
		<pubDate>Mon, 30 Jul 2007 13:22:37 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/?p=618#comment-5934</guid>
		<description>Uhhhhh.....
So what you&#039;re advocating is placing as much code under test regardless of whether it is some form of functional or unit testing?  If not you have a little bit of a conundrum to resolve because your unit tests will never involve a collaborator because a true valid unit tests never depends on anything that is not controlled by a mock implementation.  If your class that depended on the previously mentioned internal class was a true unit test it wouldn&#039;t be using the internal class for its own unit testing so changes to the internal class would never have any effect.

&quot;Similarly, what happens if I decide I no longer want to use that internal class?.......&quot;
If I hear you correctly - The unit tests that I put into my system that are suppose to protect me and make change easier sometimes actually have the opposite effect and make change more difficult because I now have a &#039;user&#039; of the class that I must update.  Now that I have succesfully put words into your mouth; I agree with you :)

The DRY principle:
What would you say about the different levels of testing and how it relates to DRY?  You typically have some form of unit testing, plus acceptance/functional testing and then some exploritory testing.  IMO each level of testing is basically a violation of the DRY principle because each level of testing operates in a silo and you have a hugh amount of duplicated effort.</description>
		<content:encoded><![CDATA[<p>Uhhhhh&#8230;..<br />
So what you&#8217;re advocating is placing as much code under test regardless of whether it is some form of functional or unit testing?  If not you have a little bit of a conundrum to resolve because your unit tests will never involve a collaborator because a true valid unit tests never depends on anything that is not controlled by a mock implementation.  If your class that depended on the previously mentioned internal class was a true unit test it wouldn&#8217;t be using the internal class for its own unit testing so changes to the internal class would never have any effect.</p>
<p>&#8220;Similarly, what happens if I decide I no longer want to use that internal class?&#8230;&#8230;.&#8221;<br />
If I hear you correctly &#8211; The unit tests that I put into my system that are suppose to protect me and make change easier sometimes actually have the opposite effect and make change more difficult because I now have a &#8216;user&#8217; of the class that I must update.  Now that I have succesfully put words into your mouth; I agree with you <img src='http://elegantcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The DRY principle:<br />
What would you say about the different levels of testing and how it relates to DRY?  You typically have some form of unit testing, plus acceptance/functional testing and then some exploritory testing.  IMO each level of testing is basically a violation of the DRY principle because each level of testing operates in a silo and you have a hugh amount of duplicated effort.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Berther</title>
		<link>http://elegantcode.com/2007/07/22/including-tests-into-the-original-assembly/comment-page-1/#comment-5877</link>
		<dc:creator>Matt Berther</dc:creator>
		<pubDate>Sun, 29 Jul 2007 20:10:37 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/?p=618#comment-5877</guid>
		<description>I am stating that you put as much code under test as possible... However, if I have an internal helper class, I dont need unit tests for that as long as I have unit tests for the public interface that exercises that helper class.

Going this route decouples my tests from the knowledge of the internal workings of my class library. I have expected inputs and expected outputs. If one of my internal classes is a collaborator to the expected output, then the test on the public interface needs to be changed, as well as the test for the helper class.

Similarly, what happens if I decide I no longer want to use that internal class? I now throw away all the work that I did for creating tests on a class that no longer exists.

Since the tests on the public interface already call to the internal classes, why would I duplicate efforts? It&#039;s called DRY (Dont Repeat Yourself).</description>
		<content:encoded><![CDATA[<p>I am stating that you put as much code under test as possible&#8230; However, if I have an internal helper class, I dont need unit tests for that as long as I have unit tests for the public interface that exercises that helper class.</p>
<p>Going this route decouples my tests from the knowledge of the internal workings of my class library. I have expected inputs and expected outputs. If one of my internal classes is a collaborator to the expected output, then the test on the public interface needs to be changed, as well as the test for the helper class.</p>
<p>Similarly, what happens if I decide I no longer want to use that internal class? I now throw away all the work that I did for creating tests on a class that no longer exists.</p>
<p>Since the tests on the public interface already call to the internal classes, why would I duplicate efforts? It&#8217;s called DRY (Dont Repeat Yourself).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Starr</title>
		<link>http://elegantcode.com/2007/07/22/including-tests-into-the-original-assembly/comment-page-1/#comment-5841</link>
		<dc:creator>David Starr</dc:creator>
		<pubDate>Sun, 29 Jul 2007 05:06:42 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/?p=618#comment-5841</guid>
		<description>You are suggesting that you should only build unit tests for public interfaces, not concrete implementation classes?

I dont get that.  Why wouldnt I put as much code under test as possible?  I dont understand your point.</description>
		<content:encoded><![CDATA[<p>You are suggesting that you should only build unit tests for public interfaces, not concrete implementation classes?</p>
<p>I dont get that.  Why wouldnt I put as much code under test as possible?  I dont understand your point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Berther</title>
		<link>http://elegantcode.com/2007/07/22/including-tests-into-the-original-assembly/comment-page-1/#comment-5820</link>
		<dc:creator>Matt Berther</dc:creator>
		<pubDate>Sat, 28 Jul 2007 22:24:49 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/?p=618#comment-5820</guid>
		<description>It could also be thoroughly argued, by me and others, that you should only exercise unit tests on your public interfaces. The internal classes would be used by the public interfaces, and if not, then you should remove them.

Dead code should be relentlessly removed from your projects.</description>
		<content:encoded><![CDATA[<p>It could also be thoroughly argued, by me and others, that you should only exercise unit tests on your public interfaces. The internal classes would be used by the public interfaces, and if not, then you should remove them.</p>
<p>Dead code should be relentlessly removed from your projects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Starr</title>
		<link>http://elegantcode.com/2007/07/22/including-tests-into-the-original-assembly/comment-page-1/#comment-5461</link>
		<dc:creator>David Starr</dc:creator>
		<pubDate>Mon, 23 Jul 2007 16:37:28 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/?p=618#comment-5461</guid>
		<description>Tom,

That&#039;s a sweet tip.  I didn&#039;t know about that attribute.

You can define the tests in the project, but omit them during the build process.  Although Visual Studio has no facility for doing this, you may do it through your build process with file masks or whatever.  Just use NAnt or MSBuild to delete your test fixture code files from the pile of code files.  This would require a naming convention, though. Lame, I guess.</description>
		<content:encoded><![CDATA[<p>Tom,</p>
<p>That&#8217;s a sweet tip.  I didn&#8217;t know about that attribute.</p>
<p>You can define the tests in the project, but omit them during the build process.  Although Visual Studio has no facility for doing this, you may do it through your build process with file masks or whatever.  Just use NAnt or MSBuild to delete your test fixture code files from the pile of code files.  This would require a naming convention, though. Lame, I guess.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom St. Clair</title>
		<link>http://elegantcode.com/2007/07/22/including-tests-into-the-original-assembly/comment-page-1/#comment-5456</link>
		<dc:creator>Tom St. Clair</dc:creator>
		<pubDate>Mon, 23 Jul 2007 14:22:28 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/?p=618#comment-5456</guid>
		<description>you can test internal classes anyway by just tagging the assebly as a friend:
[assembly: InternalsVisibleTo &quot;your.other.assembly&quot;)]

The increased size of the deliverable wouldn&#039;t be an issue if the .Net framework wouldn&#039;t require you to define the output of a project but rather allow you to define the output though a build process.  Then you could include the tests in the project, which I agree is good, but wouldn&#039;t have to include them in your production deliverable because your build script would just exclude them.</description>
		<content:encoded><![CDATA[<p>you can test internal classes anyway by just tagging the assebly as a friend:<br />
[assembly: InternalsVisibleTo "your.other.assembly")]</p>
<p>The increased size of the deliverable wouldn&#8217;t be an issue if the .Net framework wouldn&#8217;t require you to define the output of a project but rather allow you to define the output though a build process.  Then you could include the tests in the project, which I agree is good, but wouldn&#8217;t have to include them in your production deliverable because your build script would just exclude them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daddy Starr</title>
		<link>http://elegantcode.com/2007/07/22/including-tests-into-the-original-assembly/comment-page-1/#comment-5454</link>
		<dc:creator>Daddy Starr</dc:creator>
		<pubDate>Mon, 23 Jul 2007 13:29:23 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/?p=618#comment-5454</guid>
		<description>You&#039;re right about that. It does increase the size of the deliverable by the size of nunit.framewok.dll and Rhino.Mocks.dll.Â  Combined, that is 284K, which I suppose I can live with.

I realized another benefit last night, though.

I can test internal classes.</description>
		<content:encoded><![CDATA[<p>You&#8217;re right about that. It does increase the size of the deliverable by the size of nunit.framewok.dll and Rhino.Mocks.dll.Â  Combined, that is 284K, which I suppose I can live with.</p>
<p>I realized another benefit last night, though.</p>
<p>I can test internal classes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave G</title>
		<link>http://elegantcode.com/2007/07/22/including-tests-into-the-original-assembly/comment-page-1/#comment-5442</link>
		<dc:creator>Dave G</dc:creator>
		<pubDate>Mon, 23 Jul 2007 08:37:53 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/?p=618#comment-5442</guid>
		<description>It might not swell the assembly by much, but you&#039;ve now got to package all the test framework&#039;s assemblies (and dependencies) with the finished product. It&#039;s too much work to write a wrapper around the test framework to avoid having to do this.</description>
		<content:encoded><![CDATA[<p>It might not swell the assembly by much, but you&#8217;ve now got to package all the test framework&#8217;s assemblies (and dependencies) with the finished product. It&#8217;s too much work to write a wrapper around the test framework to avoid having to do this.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

