<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>Separating out unit tests</title><link>http://blogs.msdn.com/jaybaz_ms/archive/2004/09/09/227602.aspx</link><description>This question came up on a customer chat today. It’s probably interesting to a wider audience, so I’m posting it here. I'm currently doing TDD with NUnit. With the upcoming testing tools in Whidbey, how do you see the separation of tests from production</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Separating out unit tests</title><link>http://blogs.msdn.com/jaybaz_ms/archive/2004/09/09/227602.aspx#227624</link><pubDate>Thu, 09 Sep 2004 22:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:227624</guid><dc:creator>Jamie Cansdale</dc:creator><description>Hi,&lt;br&gt;&lt;br&gt;When I first heard about the InternalsVisibleTo attribute I thought it was a great solution for the 'how do you test internal types' problem.  I have since started to grow a little concerned.  Going test first is a great way to think about how your API should look from the outside.  Unfortunately this all breaks down as soon as you add an InternalsVisibleTo attribute.  Suddenly the test writer can do things an ordinary consumer of the API wouldn't be able to do.  You have lost your objective view from outside the assembly and it isn't at all obvious when you're using your target's internal types.&lt;br&gt;&lt;br&gt;I think this issue is solvable by making the interaction more explicit.  If there was a complimentary attribute on the client side it would be more obvious what was going on.  For example...&lt;br&gt;&lt;br&gt;[Test, InternalsVisible(typeof(TargetType))]&lt;br&gt;void TestInternalMethods()&lt;br&gt;{&lt;br&gt;// Test internal methods of the TargetType&lt;br&gt;}&lt;br&gt;&lt;br&gt;I believe this attribute is going to be used an awful lot and without this kind of check it has the potential to cause a lot of damage.&lt;br&gt;&lt;br&gt;Do you know who's responsibility this feature comes under?  I would like to get in touch to express my concerns.&lt;br&gt;&lt;br&gt;Thanks, Jamie.</description></item><item><title>re: Separating out unit tests</title><link>http://blogs.msdn.com/jaybaz_ms/archive/2004/09/09/227602.aspx#227671</link><pubDate>Fri, 10 Sep 2004 00:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:227671</guid><dc:creator>Kris</dc:creator><description>Hi, it seems like the most obvious current option is omitted, which is leaving test code in a separate assembly.  Reflection is an option at that point for calling internal members, however; if a class can't be adequately tested via its public interface, it seems like there's a likely need to refactor since that public interface might be solving more than it should.  What are your thoughts?&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;&lt;br&gt;Kris</description></item><item><title>re: Separating out unit tests</title><link>http://blogs.msdn.com/jaybaz_ms/archive/2004/09/09/227602.aspx#227703</link><pubDate>Fri, 10 Sep 2004 02:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:227703</guid><dc:creator>jaybaz [MS]</dc:creator><description>Kris &amp;amp; Jamie,&lt;br&gt;&lt;br&gt;I think that part of the conflict here is that the principle of &amp;quot;see your API from the consumers viewpoint&amp;quot; is difficult when the consumer has more access to the type than the test.&lt;br&gt;&lt;br&gt;For example, a 'private' nested class is worth testing, but difficult to reach with unit tests.  Similarly, an 'internal' class in one assembly is difficult to test from tests in another assembly.&lt;br&gt;&lt;br&gt;To add to the confusion, note that there are different &amp;quot;consumer viewpoints&amp;quot;.  The consumer of a 'private' nested class is the outer class.  The consumer of a 'public' type of a library vendor is your paying customer.  In both cases, writing tests from their point of view helps you design with the consumer in mind, but adhering to that principle means something quite different in practice in each case.</description></item><item><title>re: Separating out unit tests</title><link>http://blogs.msdn.com/jaybaz_ms/archive/2004/09/09/227602.aspx#227705</link><pubDate>Fri, 10 Sep 2004 02:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:227705</guid><dc:creator>jaybaz [MS]</dc:creator><description>Jamie:&lt;br&gt;&lt;br&gt;Jason Anderson is on the team creating the unit test tools in Visual Studio.  &lt;a target="_new" href="http://blogs.msdn.com/jason_anderson/"&gt;http://blogs.msdn.com/jason_anderson/&lt;/a&gt;&lt;br&gt;&lt;br&gt;The InternalsVisibleTo feature spans a number of teams, so there's not one person to engage in discussion.&lt;br&gt;&lt;br&gt;If you want to send feedback, instead of discuss, the best place is probably LadyBug: &lt;a target="_new" href="http://lab.msdn.microsoft.com/productfeedback"&gt;http://lab.msdn.microsoft.com/productfeedback&lt;/a&gt;&lt;br&gt;</description></item></channel></rss>