<?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: Getting value out of your unit tests</title>
	<atom:link href="http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/</link>
	<description>Strong opinions, weakly held</description>
	<lastBuildDate>Wed, 22 May 2013 13:39:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Daniel Fernandes</title>
		<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/#comment-1127</link>
		<dc:creator>Daniel Fernandes</dc:creator>
		<pubDate>Mon, 10 Aug 2009 17:40:28 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/18/getting-value-out-of-your-unit-tests.aspx#comment-1127</guid>
		<description>Validation tests are bit of a pain and I don&#039;t have much of a problem with multiple assertions as long as it&#039;s easy to know what&#039;s tested, there aren&#039;t too many assertions and the context is explcit.
There may be situations that instead of having to create small unit tests that try testing individual rules, the business representative would submit valid test cases and expected outcomes for the validation. This is similar to Fit but you simply embed those test cases.
Daniel</description>
		<content:encoded><![CDATA[<p>Validation tests are bit of a pain and I don&#8217;t have much of a problem with multiple assertions as long as it&#8217;s easy to know what&#8217;s tested, there aren&#8217;t too many assertions and the context is explcit.<br />
There may be situations that instead of having to create small unit tests that try testing individual rules, the business representative would submit valid test cases and expected outcomes for the validation. This is similar to Fit but you simply embed those test cases.<br />
Daniel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/#comment-1126</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Mon, 27 Jul 2009 12:48:27 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/18/getting-value-out-of-your-unit-tests.aspx#comment-1126</guid>
		<description>@Gil

This example wasn&#039;t so bad, but I&#039;m sure you&#039;ve seen ones where you have a bazillion assertions, and even worse, lots of setup-execute-verify in one test.  Instead of thinking about it, I tend to just break up tests.  It&#039;s easier than deciding for me.</description>
		<content:encoded><![CDATA[<p>@Gil</p>
<p>This example wasn&#8217;t so bad, but I&#8217;m sure you&#8217;ve seen ones where you have a bazillion assertions, and even worse, lots of setup-execute-verify in one test.  Instead of thinking about it, I tend to just break up tests.  It&#8217;s easier than deciding for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gil Zilberfeld</title>
		<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/#comment-1125</link>
		<dc:creator>Gil Zilberfeld</dc:creator>
		<pubDate>Sun, 26 Jul 2009 11:06:56 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/18/getting-value-out-of-your-unit-tests.aspx#comment-1125</guid>
		<description>Jimmy,

Thanks for the great article. 
Taking Mark&#039;s example and your response: The name of the test is vague enough to include the properties. If I read the test I understand when the user name is invalid. Keeping them together, allows me to conceptually relay that they go together.Granted, that from code maintenance point of view, the separation is needed.

But from the POV of someone new, or someone visiting the code after 6 months, wouldn&#039;t this test convey more?

Thanks

Gil Zilberfeld</description>
		<content:encoded><![CDATA[<p>Jimmy,</p>
<p>Thanks for the great article.<br />
Taking Mark&#8217;s example and your response: The name of the test is vague enough to include the properties. If I read the test I understand when the user name is invalid. Keeping them together, allows me to conceptually relay that they go together.Granted, that from code maintenance point of view, the separation is needed.</p>
<p>But from the POV of someone new, or someone visiting the code after 6 months, wouldn&#8217;t this test convey more?</p>
<p>Thanks</p>
<p>Gil Zilberfeld</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Olson</title>
		<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/#comment-1124</link>
		<dc:creator>Jason Olson</dc:creator>
		<pubDate>Sat, 20 Dec 2008 07:50:39 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/18/getting-value-out-of-your-unit-tests.aspx#comment-1124</guid>
		<description>A style I&#039;ve liked lately is the idea of having a folder named after concern of the application. Then the test class/fixture is named after the context (WhenNewStackIsCreated, for instance), and then the tests are essentially the assertions you are making (ItShouldBeEmpty(), ItShouldNotBeIndexable(), etc.).

Then, the constructor of the test fixture (at least in xUnit.net) sets up the context that every single test will run under.

I personally find that this way of thinking helps organize my own thoughts on what I&#039;m testing. And it often leads to test fixtures that are smaller (since they are about a specific context), and each test has a minimal number of asserts. Combined with AAA (Arrange/Act/Assert) style testing, it&#039;s a methodology I&#039;ve come to love. 

Just my $0.02.</description>
		<content:encoded><![CDATA[<p>A style I&#8217;ve liked lately is the idea of having a folder named after concern of the application. Then the test class/fixture is named after the context (WhenNewStackIsCreated, for instance), and then the tests are essentially the assertions you are making (ItShouldBeEmpty(), ItShouldNotBeIndexable(), etc.).</p>
<p>Then, the constructor of the test fixture (at least in xUnit.net) sets up the context that every single test will run under.</p>
<p>I personally find that this way of thinking helps organize my own thoughts on what I&#8217;m testing. And it often leads to test fixtures that are smaller (since they are about a specific context), and each test has a minimal number of asserts. Combined with AAA (Arrange/Act/Assert) style testing, it&#8217;s a methodology I&#8217;ve come to love. </p>
<p>Just my $0.02.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/#comment-1123</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Fri, 19 Dec 2008 14:53:41 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/18/getting-value-out-of-your-unit-tests.aspx#comment-1123</guid>
		<description>@Mark

One assert per test.  If you have a common context/setup, like this one, pull that into its own setup method, or test fixture class, and have tests for each assert, with good test names describing what the user experience should be.</description>
		<content:encoded><![CDATA[<p>@Mark</p>
<p>One assert per test.  If you have a common context/setup, like this one, pull that into its own setup method, or test fixture class, and have tests for each assert, with good test names describing what the user experience should be.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Levison</title>
		<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/#comment-1122</link>
		<dc:creator>Mark Levison</dc:creator>
		<pubDate>Fri, 19 Dec 2008 14:36:27 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/18/getting-value-out-of-your-unit-tests.aspx#comment-1122</guid>
		<description>What about this case:

[Test]
public void EmptyUsernameShouldNotBeValid()
{

var user = new User();

user.Username = &quot;  &quot;;
user.IsValid.ShouldBeFalse();
assertEquals(&quot; &quot;, user.getName());

}

This is a lousy example - but I often find useful to assert two or threes properties of an object, based on calling on a single production method. 

In some cases maybe I want to assert invariants.</description>
		<content:encoded><![CDATA[<p>What about this case:</p>
<p>[Test]<br />
public void EmptyUsernameShouldNotBeValid()<br />
{</p>
<p>var user = new User();</p>
<p>user.Username = &#8221;  &#8220;;<br />
user.IsValid.ShouldBeFalse();<br />
assertEquals(&#8221; &#8220;, user.getName());</p>
<p>}</p>
<p>This is a lousy example &#8211; but I often find useful to assert two or threes properties of an object, based on calling on a single production method. </p>
<p>In some cases maybe I want to assert invariants.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/#comment-1121</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Fri, 19 Dec 2008 14:01:20 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/18/getting-value-out-of-your-unit-tests.aspx#comment-1121</guid>
		<description>@Micha

Yep, that&#039;s much more like it.

@Frank, @Tosh

Workin on it, thanks for the heads up!</description>
		<content:encoded><![CDATA[<p>@Micha</p>
<p>Yep, that&#8217;s much more like it.</p>
<p>@Frank, @Tosh</p>
<p>Workin on it, thanks for the heads up!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tosh</title>
		<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/#comment-1120</link>
		<dc:creator>Tosh</dc:creator>
		<pubDate>Fri, 19 Dec 2008 12:51:07 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/18/getting-value-out-of-your-unit-tests.aspx#comment-1120</guid>
		<description>I&#039;m with Frank: add some more value to the post by including examples of good or excellent tests that address the issues pointed out in the article.</description>
		<content:encoded><![CDATA[<p>I&#8217;m with Frank: add some more value to the post by including examples of good or excellent tests that address the issues pointed out in the article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Reu&#223;</title>
		<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/#comment-1119</link>
		<dc:creator>Michael Reu&#223;</dc:creator>
		<pubDate>Fri, 19 Dec 2008 12:11:36 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/18/getting-value-out-of-your-unit-tests.aspx#comment-1119</guid>
		<description>Following rule #1 I&#039;d go for
 
[Test]
public void EmptyUsernameShouldNotBeValid()
{
 var user = new User();
 user.Username = &quot;  &quot;;
 user.IsValid.ShouldBeFalse();
}
etc.

Right?

Micha.</description>
		<content:encoded><![CDATA[<p>Following rule #1 I&#8217;d go for</p>
<p>[Test]<br />
public void EmptyUsernameShouldNotBeValid()<br />
{<br />
 var user = new User();<br />
 user.Username = &#8221;  &#8220;;<br />
 user.IsValid.ShouldBeFalse();<br />
}<br />
etc.</p>
<p>Right?</p>
<p>Micha.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lee Brandt</title>
		<link>http://lostechies.com/jimmybogard/2008/12/19/getting-value-out-of-your-unit-tests/#comment-1118</link>
		<dc:creator>Lee Brandt</dc:creator>
		<pubDate>Fri, 19 Dec 2008 08:27:05 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/12/18/getting-value-out-of-your-unit-tests.aspx#comment-1118</guid>
		<description>@Frank: This would be my stab at it. If this is what you&#039;re asking.
[Test]
public void ShouldValidateUsername()
{
  var user = new User();
  user.Username = &quot;  &quot;;
  user.IsValid.ShouldBeFalse();
}

@bogardj
Great article. Great points. For me, BDD has been the language shift that pulled me away from my bad TDD habits. I think the reason people get sucked into the fixture/class pattern is it makes them feel safe about code coverage. If they make one fixture per class and one to n tests per method, they&#039;ll have great coverage. This, of course, leads to the problem you explained above of leading you away from the REAL purpose of TDD which is to verify and document the behaviors of the system.

Always enjoy reading your posts,
Lee</description>
		<content:encoded><![CDATA[<p>@Frank: This would be my stab at it. If this is what you&#8217;re asking.<br />
[Test]<br />
public void ShouldValidateUsername()<br />
{<br />
  var user = new User();<br />
  user.Username = &#8221;  &#8220;;<br />
  user.IsValid.ShouldBeFalse();<br />
}</p>
<p>@bogardj<br />
Great article. Great points. For me, BDD has been the language shift that pulled me away from my bad TDD habits. I think the reason people get sucked into the fixture/class pattern is it makes them feel safe about code coverage. If they make one fixture per class and one to n tests per method, they&#8217;ll have great coverage. This, of course, leads to the problem you explained above of leading you away from the REAL purpose of TDD which is to verify and document the behaviors of the system.</p>
<p>Always enjoy reading your posts,<br />
Lee</p>
]]></content:encoded>
	</item>
</channel>
</rss>
