<?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>Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx</link><description>In a previous post Ben Lowery asked the question? Why is the collection in your test fixture class static? Here is the code from the previous post: [ TestFixture ] public class BookmarkCollectionFixture { private static BookmarkCollection collection;</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>James Newkirk: Variables in TestFixture classes should be static</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275241</link><pubDate>Sun, 05 Dec 2004 12:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275241</guid><dc:creator>.NET Addicted</dc:creator><description /></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275319</link><pubDate>Sun, 05 Dec 2004 19:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275319</guid><dc:creator>Eric Newton</dc:creator><description>Why not bite the bullet and fix it to do it right?&lt;br&gt;&lt;br&gt;I get all over Microsoft people about this...</description></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275333</link><pubDate>Sun, 05 Dec 2004 20:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275333</guid><dc:creator>Robert Watkins</dc:creator><description>I'm not familar with NUnit at all, but I've assumed you've used a Test interface ala JUnit.&lt;br&gt;&lt;br&gt;If so, couldn't you take the approach of introducing a second TestCase implementation? If it's all interfaces, all you'll need to modify would be the creation code.</description></item><item><title>Not an anti-pattern</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275350</link><pubDate>Sun, 05 Dec 2004 21:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275350</guid><dc:creator>Cedric</dc:creator><description>When did dependency of test methods become an anti-pattern?  Anybody who does some serious testing (not just unit testing) needs to have test methods that depend on each other.  That's exactly what setUp() is, BTW, a method that needs to be invoked before any other test method.  It's not hard to see the importance of extending this concept to test methods themselves.  TestNG implements this with dependent methods and &amp;quot;skips&amp;quot;, see &lt;a target="_new" href="http://beust.com/testng"&gt;http://beust.com/testng&lt;/a&gt; for more details.&lt;br&gt;&lt;br&gt;If you want truly independent test methods, put them in different classes.&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275364</link><pubDate>Sun, 05 Dec 2004 22:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275364</guid><dc:creator>James Newkirk</dc:creator><description>I am no longer the admin of NUnit so I cannot fix it. I can recommend to Charlie that he fix it. A big problem would be backwards compatibility but that is Charlie's decision. </description></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275365</link><pubDate>Sun, 05 Dec 2004 22:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275365</guid><dc:creator>James Newkirk</dc:creator><description>Cedric, I think we will agree to disagree. SetUp runs prior to every test being executed. That is different than test-1 storing a result that test-2 depends upon. That case is what I would call an anti-pattern for unit testing. In other forms of testing it can be useful but for the types of testing that I use NUnit for I would not want to do that. </description></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275390</link><pubDate>Mon, 06 Dec 2004 00:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275390</guid><dc:creator>Darren Oakey</dc:creator><description>Take a vote! &lt;br&gt;&lt;br&gt;- I think most people would rather you just fixed the problem.  Anything it breaks should always have been broken anyway.&lt;br&gt;&lt;br&gt;</description></item><item><title>James Newkirk blogs again</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275447</link><pubDate>Mon, 06 Dec 2004 06:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275447</guid><dc:creator>Darrell Norton's Blog</dc:creator><description>James Newkirk blogs again</description></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275456</link><pubDate>Mon, 06 Dec 2004 04:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275456</guid><dc:creator>Cedric</dc:creator><description>James, I'm okay with invoking setUp() before each test method, but that's redundant with reinstantiating the test each time and it forces you to use statics just to work around this &amp;quot;design decision&amp;quot;.&lt;br&gt;&lt;br&gt;What would you think of a framework that forces you to declare all your fields static? &lt;br&gt;</description></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275496</link><pubDate>Mon, 06 Dec 2004 06:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275496</guid><dc:creator>Jonathan de Halleux</dc:creator><description>Hi,&lt;br&gt;&lt;br&gt;Initially MbUnit would create a new fixture for each new test as in JUnit, but after facing a few problems, I finally went for the '1 fixture instance for all' solution for a number of reasons (although it breaks the axiom of atomicity between tests):&lt;br&gt;&lt;br&gt; - TestFixtureSetUp and TestFixtureTearDown would have to be static which would seriously break exisiting code. This was the main why I move to '1 fixture' solution. You cannot expect people to use static variables in TestFixtureSetup unless you explicity enforce it static. If you don't enforce it static, people forget to use static variable and start to see some strange results, etc...&lt;br&gt;&lt;br&gt; - I kind like to write 'this.' on the editor and choose the variable from the intellissense. With static variables, you just loose this cool feature. It's defail but after it's all about details.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;Peli.</description></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275529</link><pubDate>Mon, 06 Dec 2004 10:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275529</guid><dc:creator>Thomas Eyde</dc:creator><description>I really don't see why it matter. A new coder will soon learn how the testfixtures work when he sees tests that run and tests which don't. The static will not remove the potential dependencies.</description></item><item><title>Perch</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275738</link><pubDate>Mon, 06 Dec 2004 19:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275738</guid><dc:creator>ABS</dc:creator><description /></item><item><title>Test Case Instancing with CFNUnitBridge</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275742</link><pubDate>Mon, 06 Dec 2004 20:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275742</guid><dc:creator>Trey's Brain Dump</dc:creator><description /></item><item><title>Test Case Instancing with CFNUnitBridge</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#275744</link><pubDate>Mon, 06 Dec 2004 20:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275744</guid><dc:creator>Trey's Brain Dump</dc:creator><description /></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#276035</link><pubDate>Tue, 07 Dec 2004 00:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:276035</guid><dc:creator>AndrewSeven</dc:creator><description>There seems to be a reasonable concensus about how it should be, so why not make the change and keep a flag that allows people to keep the old behavior.&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#278509</link><pubDate>Wed, 08 Dec 2004 21:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:278509</guid><dc:creator>James</dc:creator><description>Yeah, I hate non-static nunit classes.  Nice article!</description></item><item><title>re: Why variables in NUnit [TestFixture] classes should be static? </title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#327164</link><pubDate>Mon, 20 Dec 2004 03:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:327164</guid><dc:creator>Charlie Poole</dc:creator><description>Google just alerted me about this thread... I invite everyone who cares how NUnit ought to do it to post on the nunit-developer list. That way, a number of folks who routinely put in their 2 cents about the direction of NUnit will get to see and comment on it.&lt;br&gt;&lt;br&gt;FWIW, I don't see this as a difficult change to make, if people think it's the right thing to do.&lt;br&gt;</description></item><item><title>XUnit for .NET</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#5026805</link><pubDate>Fri, 21 Sep 2007 10:23:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5026805</guid><dc:creator>IT Builder - Gabriel Oliva C.  &lt;img src="/blogs/gabriel.oliva/image.axd?picture=untitled.bmp" alt="" hspace="5" width="133" height="53" align="right" border=0/&gt;&lt;a href="http://www.linkedin.com/in/gabrieloliva" &gt;&lt;img src="http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Gabriel Oliva Chimal's profile on LinkedIn"&gt;&lt;/a&gt;</dc:creator><description>&lt;p&gt;XUnit for .NET&lt;/p&gt;</description></item><item><title>
	XUnit for .NET
</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#5026806</link><pubDate>Fri, 21 Sep 2007 10:23:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5026806</guid><dc:creator>
	XUnit for .NET
</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.itbuilder.com.mx/blogs/gabriel.oliva/post/XUnit-for-NET.aspx"&gt;http://www.itbuilder.com.mx/blogs/gabriel.oliva/post/XUnit-for-NET.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>xUnit.net</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#5371250</link><pubDate>Mon, 08 Oct 2007 23:28:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5371250</guid><dc:creator>Joycode@Ab110.com</dc:creator><description>&lt;p&gt;上个月，NUnit的作者James Newkirk 宣布推出 了新的单元测试框架， xUnit.net 。他列出了从以前的单元测试框架得到的教训后所做的改动： 每个测试方法都对应一个新对象实例。 为提高测试的隔离性&lt;/p&gt;
</description></item><item><title>Mocks and the Dangers of Overspecified Software</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#6804890</link><pubDate>Wed, 19 Dec 2007 12:28:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6804890</guid><dc:creator>Ian Cooper [MVP]</dc:creator><description>&lt;p&gt;I&amp;amp;#39;ll be back on LINQ architecture after the holidays, but in the meantime, I wanted to share some&lt;/p&gt;
</description></item><item><title> James Newkirk s Blog Why variables in NUnit TestFixture classes | Outdoor Ceiling Fans</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#9669689</link><pubDate>Sun, 31 May 2009 17:21:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9669689</guid><dc:creator> James Newkirk s Blog Why variables in NUnit TestFixture classes | Outdoor Ceiling Fans</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://outdoorceilingfansite.info/story.php?id=2386"&gt;http://outdoorceilingfansite.info/story.php?id=2386&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> James Newkirk s Blog Why variables in NUnit TestFixture classes | Outdoor Ceiling Fans</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#9670656</link><pubDate>Sun, 31 May 2009 20:39:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9670656</guid><dc:creator> James Newkirk s Blog Why variables in NUnit TestFixture classes | Outdoor Ceiling Fans</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://outdoorceilingfansite.info/story.php?id=20022"&gt;http://outdoorceilingfansite.info/story.php?id=20022&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> James Newkirk s Blog Why variables in NUnit TestFixture classes | low cost car insurance</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#9765608</link><pubDate>Wed, 17 Jun 2009 07:16:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9765608</guid><dc:creator> James Newkirk s Blog Why variables in NUnit TestFixture classes | low cost car insurance</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://lowcostcarinsurances.info/story.php?id=6887"&gt;http://lowcostcarinsurances.info/story.php?id=6887&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> James Newkirk s Blog Why variables in NUnit TestFixture classes | home lighting</title><link>http://blogs.msdn.com/jamesnewkirk/archive/2004/12/04/275172.aspx#9779876</link><pubDate>Fri, 19 Jun 2009 08:48:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9779876</guid><dc:creator> James Newkirk s Blog Why variables in NUnit TestFixture classes | home lighting</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://homelightingconcept.info/story.php?id=1564"&gt;http://homelightingconcept.info/story.php?id=1564&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>