<?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"
	>
<channel>
	<title>Comments on: On the topic of assertions</title>
	<atom:link href="http://www.hackerdude.com/2007/03/06/on-the-topic-of-assertions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackerdude.com/2007/03/06/on-the-topic-of-assertions/</link>
	<description>Software Development Blog</description>
	<pubDate>Sat, 05 Jul 2008 01:26:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Hackerdude</title>
		<link>http://www.hackerdude.com/2007/03/06/on-the-topic-of-assertions/#comment-5369</link>
		<dc:creator>Hackerdude</dc:creator>
		<pubDate>Mon, 12 Mar 2007 23:07:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackerdude.com/2007/03/06/on-the-topic-of-assertions/#comment-5369</guid>
		<description>Well, that's probably an exception. If your test name creates a redunancy you probably don't need to add it twice out of respect of the DRY principle. However under some circumstances (integration tests come to mind, and there may be others) you need more than one assertion per test so the build time doesn't become a problem (long build times can kill a project, so some project managers tell me).

At other times I worry about the granularity of the tests becoming a barrier to non-developers who want to know the status of the project. I fear that so many individual tests (as opposed to multiple assertions inside an overarching test) may add to confusion if your audience (the people who read the junit results) is composed of more than developers. It brings to bear the debate of &lt;a href="http://www.elilopian.com/2006/10/31/multiple-asserts-in-a-single-unit-test/" rel="nofollow"&gt;one assertion per test vs. one assertion per scenario&lt;/a&gt;. No silver bullet of course.

So although Rob's point is indeed an important clarification, still keep in mind that if you have to have more than one assertion, do make sure you add strings to them. Also make sure those methods really are descriptive.</description>
		<content:encoded><![CDATA[<p>Well, that&#8217;s probably an exception. If your test name creates a redunancy you probably don&#8217;t need to add it twice out of respect of the DRY principle. However under some circumstances (integration tests come to mind, and there may be others) you need more than one assertion per test so the build time doesn&#8217;t become a problem (long build times can kill a project, so some project managers tell me).</p>
<p>At other times I worry about the granularity of the tests becoming a barrier to non-developers who want to know the status of the project. I fear that so many individual tests (as opposed to multiple assertions inside an overarching test) may add to confusion if your audience (the people who read the junit results) is composed of more than developers. It brings to bear the debate of <a href="http://www.elilopian.com/2006/10/31/multiple-asserts-in-a-single-unit-test/" onclick="javascript:pageTracker._trackPageview('/outbound/comment/www.elilopian.com');" rel="nofollow">one assertion per test vs. one assertion per scenario</a>. No silver bullet of course.</p>
<p>So although Rob&#8217;s point is indeed an important clarification, still keep in mind that if you have to have more than one assertion, do make sure you add strings to them. Also make sure those methods really are descriptive.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Meyer</title>
		<link>http://www.hackerdude.com/2007/03/06/on-the-topic-of-assertions/#comment-5072</link>
		<dc:creator>Rob Meyer</dc:creator>
		<pubDate>Wed, 07 Mar 2007 00:29:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.hackerdude.com/2007/03/06/on-the-topic-of-assertions/#comment-5072</guid>
		<description>I've never quite been able to reconcile their redundancy with the test names.

I'm okay with assertion descriptions, but I do think that if your tests are well named and match the assertion (and there's just one), it still remains pretty clear. ex:

public void Test_ViewIsPopulatedWithMySuperDuperFlag_When_UserIsSuperDuper()
{
  // blah blah
  assertTrue(view.SuperDuperFlag);
}

I think the report from a test like that is totally readable. I like having very descriptive test names, and if you have them the descriptions sometimes seem redundant.

Now, if you have one of those cases where the assertion is not so obvious, or you're (for a decent reason) doing multiple assertions, descriptions are perfect.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve never quite been able to reconcile their redundancy with the test names.</p>
<p>I&#8217;m okay with assertion descriptions, but I do think that if your tests are well named and match the assertion (and there&#8217;s just one), it still remains pretty clear. ex:</p>
<p>public void Test_ViewIsPopulatedWithMySuperDuperFlag_When_UserIsSuperDuper()<br />
{<br />
  // blah blah<br />
  assertTrue(view.SuperDuperFlag);<br />
}</p>
<p>I think the report from a test like that is totally readable. I like having very descriptive test names, and if you have them the descriptions sometimes seem redundant.</p>
<p>Now, if you have one of those cases where the assertion is not so obvious, or you&#8217;re (for a decent reason) doing multiple assertions, descriptions are perfect.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
