<?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>Testing Private Methods/Member Variables - Should you or shouldn't you</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx</link><description>One of the often requested features of NUnit was the ability to test private member variables and private methods. I resisted because I always felt that if you limited yourself to the public interface that enabled you to freely change the implementation</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Testing Private Methods/Member Variables - Should you or shouldn't you</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#150383</link><pubDate>Mon, 07 Jun 2004 21:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150383</guid><dc:creator>Todd</dc:creator><description>I am split on whether or not we should be performing tests on private members. When I was first introduced to TDD by a former coworker, his philosophy was &amp;quot;develop for testability&amp;quot;. And this would involve exposing members just for the purpose of developing tests against them. Of course, I have come to realize this is a horrible idea. If I were to lean one way, I would say testing only the public interfaces is the way to go. When someone consumes your object, they are only using the public interfaces so writing tests against these members makes sense. However, I can also understand the argument to hit against the private members.</description></item><item><title>RE: Testing Private Methods/Member Variables - Should you or shouldn't you</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#150402</link><pubDate>Mon, 07 Jun 2004 22:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150402</guid><dc:creator>nospamplease75@yahoo.com (Haacked)</dc:creator><description>That's pretty nice.  In 99 out of 100 cases, I'd agree that your setting yourself up for a world of hurt if you test this way.  It would be better to refactor your code so that the private code gets tested via the appropriate usage of the public interface.&lt;br&gt;&lt;br&gt;However, this is nice for that 1 case in 100 when you really need to get at the private members to save time in writing tests.</description></item><item><title>re: Testing Private Methods/Member Variables - Should you or shouldn't you</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#150540</link><pubDate>Tue, 08 Jun 2004 03:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150540</guid><dc:creator>kevin white</dc:creator><description>When all you have is a hammer....&lt;br&gt;&lt;br&gt;The internals of an object certainly should be tested in some way. But unit tested? I don't think so.</description></item><item><title>Unit testing of private members</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#150647</link><pubDate>Tue, 08 Jun 2004 09:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150647</guid><dc:creator>jenswinter.com</dc:creator><description /></item><item><title>re: Testing Private Methods/Member Variables - Should you or shouldn't you</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#150905</link><pubDate>Tue, 08 Jun 2004 13:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150905</guid><dc:creator>Jim Argeropoulos</dc:creator><description>I like to write all my tests as a part of my class that I am working on. This requires me to have #ifdef all over the place, but I don't mind too much.&lt;br&gt;&lt;br&gt;That said, I do not test member variables. I only test functions/properties. &lt;br&gt;&lt;br&gt;I don't like having to make things marked as internal, public just so that I can test it. But I also do test things marked as protected and private. If I have my tests at a granular level, I may have to change my tests more often, but they are more akin to what I would do debugging.&lt;br&gt;&lt;br&gt;I will experiment with the idea of only testing public interfaces.</description></item><item><title>re: Unit Testing C# Internal Members</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#150916</link><pubDate>Tue, 08 Jun 2004 16:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150916</guid><dc:creator>Steven M. Cohn's WebLog</dc:creator><description /></item><item><title>PrivateObject Unit Tester</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#151236</link><pubDate>Wed, 09 Jun 2004 00:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:151236</guid><dc:creator>Steven M. Cohn's WebLog</dc:creator><description /></item><item><title>PrivateObject Unit Tester</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#151240</link><pubDate>Wed, 09 Jun 2004 00:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:151240</guid><dc:creator>Steven M. Cohn's WebLog</dc:creator><description /></item><item><title>re: Testing Private Methods/Member Variables - Should you or shouldn't you</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#151339</link><pubDate>Wed, 09 Jun 2004 00:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:151339</guid><dc:creator>Darren Oakey</dc:creator><description>There is another option here.&lt;br&gt;&lt;br&gt;I believe that&lt;br&gt;a) it is an offense to test below the public interface&lt;br&gt;b) we should be aiming at 100% test coverage?&lt;br&gt;&lt;br&gt;ie - every private method should be tested, BUT THROUGH THE PUBLIC INTERFACE.  There is _no excuse_ for white box testing - the whole point is that we want to be able to refactor without changing our tests, so you actually decrease stability by allowing white-box testing, because programmers get used to changing unit tests when things go wrong..&lt;br&gt;&lt;br&gt;However, through the use of smart testing and coverage tools, you should be able to create situations through the public interface that exercise every private field and method.  (And if you can't - they shouldn't be there!!!)&lt;br&gt;&lt;br&gt;</description></item><item><title>TDD - White Box Testing</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#151384</link><pubDate>Wed, 09 Jun 2004 05:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:151384</guid><dc:creator>Todd Kitta's Blog</dc:creator><description /></item><item><title>TDD - White Box Testing</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#151385</link><pubDate>Wed, 09 Jun 2004 05:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:151385</guid><dc:creator>Todd Kitta's Blog</dc:creator><description /></item><item><title>Geek Notes 2004-06-12</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#154453</link><pubDate>Sun, 13 Jun 2004 06:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:154453</guid><dc:creator>Geek Noise</dc:creator><description /></item><item><title>Geek Notes 2004-06-12</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#154457</link><pubDate>Sun, 13 Jun 2004 06:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:154457</guid><dc:creator>Geek Noise</dc:creator><description /></item><item><title>Unit Testing in Whidbey - some pointers for improvement</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#154775</link><pubDate>Mon, 14 Jun 2004 00:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:154775</guid><dc:creator>ISerializable</dc:creator><description /></item><item><title>re: White-box Unit Testing - in whidbey</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#154895</link><pubDate>Mon, 14 Jun 2004 06:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:154895</guid><dc:creator>Barry Gervin's Software Architecture Perspectives</dc:creator><description /></item><item><title>re: Create nUnit test classes in separate projects or in same project as tested classes?</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#156007</link><pubDate>Tue, 15 Jun 2004 16:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:156007</guid><dc:creator>miguel jimenez's coding blog</dc:creator><description /></item><item><title>re: Testing Private Methods/Member Variables - Should you or shouldn't you</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#157719</link><pubDate>Thu, 17 Jun 2004 01:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:157719</guid><dc:creator>James Newkirk</dc:creator><description>Jay Bazuzi adds some additional information on his blog, check it out.  &lt;br&gt;&lt;br&gt;&lt;a target="_new" href="http://weblogs.asp.net/jaybaz_ms/archive/2004/06/11/153978.aspx"&gt;http://weblogs.asp.net/jaybaz_ms/archive/2004/06/11/153978.aspx&lt;/a&gt;</description></item><item><title>re: Testing Private Methods/Member Variables - Should you or shouldn't you</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#201926</link><pubDate>Fri, 30 Jul 2004 13:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:201926</guid><dc:creator>Clark</dc:creator><description>While I think this should be rarely used, I think that its important to have the ability to test private methods in certain cases.&lt;br&gt;&lt;br&gt;Where can I find PrivateObject?  Team System is not available yet to the public, right?  The best I could find was: &lt;a target="_new" href="http://weblogs.asp.net/stevencohn/archive/2004/06/08/151235.aspx"&gt;http://weblogs.asp.net/stevencohn/archive/2004/06/08/151235.aspx&lt;/a&gt; and that isn't quite the same as the above.&lt;br&gt;&lt;br&gt;Thanks.</description></item><item><title>Piotr Woloszyn &amp;raquo; To test or not to test</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/06/07/150361.aspx#6714815</link><pubDate>Sun, 09 Dec 2007 20:46:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6714815</guid><dc:creator>Piotr Woloszyn » To test or not to test</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.woloszyn.org/2007/12/09/to-test-or-not-to-test/"&gt;http://www.woloszyn.org/2007/12/09/to-test-or-not-to-test/&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>