<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sword Systems &#187; unit test</title>
	<atom:link href="http://swordsystems.com/category/unit-test/feed/" rel="self" type="application/rss+xml" />
	<link>http://swordsystems.com</link>
	<description>Cutting Commentary</description>
	<lastBuildDate>Tue, 15 Jun 2010 13:07:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Grails, Maven, packaging, and skipTests fun</title>
		<link>http://swordsystems.com/2010/04/22/grails-maven-packaging-and-skiptests-fun/</link>
		<comments>http://swordsystems.com/2010/04/22/grails-maven-packaging-and-skiptests-fun/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 16:25:55 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[frustration]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[unit test]]></category>

		<guid isPermaLink="false">http://swordsystems.com/?p=62</guid>
		<description><![CDATA[The grails maven plugin honors the maven.test.skip option (which turns off compiling and executing tests), but not the skipTests option (which only turns off executing tests).  This means that you cannot easily create a package with test classes in it without running all of the tests.  I finally come up with a close [...]]]></description>
			<content:encoded><![CDATA[<p>The grails maven plugin honors the <code>maven.test.skip</code> option (which turns off compiling and executing tests), but not the <code>skipTests</code> option (which only turns off executing tests).  This means that you cannot easily create a package with test classes in it without running all of the tests.  I finally come up with a close work around:<br />
<code><br />
mvn clean grails:exec install -Dcommand=test-app -Dargs="-unit DoesNotExist" -Dmaven.test.skip=true<br />
</code><br />
By explicitly listing the <code>test-app</code> command but specifying a test that does not exist, I was able to get the unit tests to be compiled.  Since I only needed some common testing files in my package, this works for me.  If someone wanted to package both the unit and integration tests, I don&#8217;t think this would work.  I filed a new issue in the <a href="http://jira.codehaus.org/browse/GRAILS-6188">Grails Jira</a> to try to get a real resolution.</p>
]]></content:encoded>
			<wfw:commentRss>http://swordsystems.com/2010/04/22/grails-maven-packaging-and-skiptests-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cruising on other people&#8217;s work</title>
		<link>http://swordsystems.com/2009/09/11/cruising-on-other-peoples-work/</link>
		<comments>http://swordsystems.com/2009/09/11/cruising-on-other-peoples-work/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 14:48:26 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[unit test]]></category>

		<guid isPermaLink="false">http://swordsystems.com/?p=23</guid>
		<description><![CDATA[I love it when other people do my work for me.  For example, I needed to store a few random settings in a Grails app, such as the last time a service polled an external resource.  So I went to the main Grails Plugin site and, sure enough, someone else has already written a Grails [...]]]></description>
			<content:encoded><![CDATA[<p>I love it when other people do my work for me.  For example, I needed to store a few random settings in a Grails app, such as the last time a service polled an external resource.  So I went to the main <a href="http://grails.org/plugin/category/all" target="_blank">Grails Plugin</a> site and, sure enough, someone else has already written a <a href="http://grails.org/plugin/settings" target="_blank">Grails Settings</a> plugin.  It needs a few enhancements to do what I want, but it&#8217;s better than starting from scratch.  While I was perusing the plugin list, I found a few others that can replace features I had started to sketch out (like <a href="http://grails.org/plugin/taggable" target="_blank">Taggable</a>) and was inspired by yet others that would let me easily add features that I hadn&#8217;t thought of before (like <a href="http://grails.org/plugin/commentable" target="_blank">Commentable </a>and <a href="http://grails.org/plugin/sparkline" target="_blank">Sparkline</a>).</p>
<p>Another example is yet another good <a href=" http://agileice.blogspot.com/2009/09/grails-integration-testing.html" target="_blank">post</a> by my friend and coworker Jeff Erikson detailing his research into problems with Grails config options getting wiped during integration tests.  I had been meaning to write up a note about how the GrailsUnitTestCase class hides the true config settings, so you don&#8217;t want to accidentally use it in integration tests.  Jeff took my little tip a lot farther with his post.  Thanks, Jeff!</p>
]]></content:encoded>
			<wfw:commentRss>http://swordsystems.com/2009/09/11/cruising-on-other-peoples-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Groovy Categories vs ExpandoMetaClass</title>
		<link>http://swordsystems.com/2009/04/29/groovy-categories-vs-expandometaclass/</link>
		<comments>http://swordsystems.com/2009/04/29/groovy-categories-vs-expandometaclass/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 19:23:00 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[ExpandoMetaClass]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[unit test]]></category>

		<guid isPermaLink="false">http://swordsystems.com/?p=4</guid>
		<description><![CDATA[I first saw Groovy in Nov 2007 and promptly decided to dive in over my head and write a DSL in it.  One thing that I never quite got was why one would want to use a Category versus ExpandoMetaClass.  Having to create a class with a bunch of static methods and then [...]]]></description>
			<content:encoded><![CDATA[<p>I first saw Groovy in Nov 2007 and promptly decided to dive in over my head and write a DSL in it.  One thing that I never quite got was why one would want to use a Category versus ExpandoMetaClass.  Having to create a class with a bunch of static methods and then surround other classes in it didn&#8217;t seem very elegant.  Directly adding behavior to a class with an ExpandoMetaClass is much more straightforward.  I thought that the Category approach must be a hold over from Groovy releases prior to 1.5 when ExpandoMetaClass was added.  The only use case I could come up with for them was if you wanted to add the same functionality to a set of classes &#8211; sort of an AOP view of things.</p>
<p>But then Groovy 1.6 came out and I saw that the team had added some very cool annotations to make categories even more powerful and easier to use.  (See <a href="http://www.infoq.com/articles/groovy-1-6 ">InfoQ </a>for a great write up of the 1.6 features.)  Okay &#8211; you don&#8217;t improve a dead feature, so what was I missing?</p>
<p>This past weekend I got a chance to ask the person from whom I first learned about Groovy, Scott Davis.  His Blue Pill and Red Pill talks at NFJS were what first got my mind churning about the possibilities that Groovy opened up.  Before sitting in on another of his talks at the most recent NFJS conference this past weekend, I asked him why one would use categories in a DSL rather than modifying meta classes? His answer told me that I was asking the wrong question.  The strength of categories is in scoping &#8211; modifying behavior for a limited period of time.  The primary example he gave was for unit tests.  A category can short circuit certain behavior (like retrieving info from a DB or from a file) to make it easier to test certain behavior in isolation.  This makes a lot of sense.  Mocks/stubs have their place;  they are useful when you need to work with an object in a very limited sense &#8211; just a few calls.  Then there are times when you want a real object doing 95% of what it is supposed to do, but you want to take over in just a few situations to be able to insert custom behavior.  e.g. in a unit test when you want to short circuit network or file-based activity or you want to purposefully force an error condition.</p>
<p>It so happens that I really need to improve the unit tests for some network-based components in the ETL system that I work with.  The primary one is called GetHttpContent, so you can imagine that unit testing it can be a pain.  I&#8217;ll give Categories a closer look to see if they can help me out.  Unfortunately, I have to wait until we finish shifting to a our new project structure because right now there are so many dependencies in the primary project that if I work on a groovy file in that project in Eclipse I lose ~20M of memory every time I edit it.  But the limitations (and benefits) of the Eclipse groovy plugin can wait for another post.</p>
]]></content:encoded>
			<wfw:commentRss>http://swordsystems.com/2009/04/29/groovy-categories-vs-expandometaclass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
