<?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>Outrospective.org &#187; Testing</title>
	<atom:link href="http://outrospective.org/wordpress/categories/software-development/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://outrospective.org/wordpress</link>
	<description></description>
	<lastBuildDate>Wed, 14 Mar 2012 07:55:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Junit Kungfu</title>
		<link>http://outrospective.org/wordpress/2010/10/junit-kungfu/</link>
		<comments>http://outrospective.org/wordpress/2010/10/junit-kungfu/#comments</comments>
		<pubDate>Sun, 03 Oct 2010 15:40:04 +0000</pubDate>
		<dc:creator>Kon</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[hamcrest]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[mockito]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://outrospective.org/wordpress/2010/10/junit-kungfu/</guid>
		<description><![CDATA[A great presentation with audio that talks about Junit 4, test naming and other things.  I liked this presentation because it starts expression Behaviour Driven Development concepts without actually using a Behaviour Driven Development Framework.  Additionally its one of the &#8230; <a href="http://outrospective.org/wordpress/2010/10/junit-kungfu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://www.dzone.com/links/r/junit_kung_fu_getting_more_out_of_your_unit_tests.html" target="_blank">great presentation with audio</a> that talks about Junit 4, test naming and other things.  I liked this presentation because it starts expression Behaviour Driven Development concepts without actually using a Behaviour Driven Development Framework.  Additionally its one of the more in-depth presentations covering the new features of JUnit like Rules.</p>
<p>The presenter is John Ferguson Smart who runs testing and agile tools bootcamps around Australia and NZ (as well as elsewhere) so if you are in the vacinity you should consider looking into em.</p>
<p>My notes from the presentation:</p>
<h3>Naming tests</h3>
<p>Dont use the name <strong>testXXX</strong> – you aren’t testing methods of your code</p>
<p>You are testing use cases – what should your class be doing</p>
<p>Take out private methods, maybe extract to a separate class and test those separately if they are getting too big.</p>
<p>Use the word <em>should</em>.  Express an outcome</p>
<p><strong>Class Name: </strong>When is a behaviour applicable<br />
<strong>Method Name:</strong> When at is the behaviour testing</p>
<p>Tests become more readable.</p>
<h3>Arrange-Act-Assert</h3>
<p>Create the test collaborators &#8211; Inputs and Expected Outputs (Arrange)</p>
<p>Test the behaviour (Act)</p>
<p>Verify behaviour is correct (Assert)</p>
<h3>Extending Hamcrest Matchers</h3>
<p>Combine matchers together – hasItem(someOtherHasPropertyMatcherYouPreviouslyDefined)</p>
<p>Create a new matcher –</p>
<ol>
<li>Extend TypeSafeMatcher&lt;type of thing you are checking against)</li>
<li>Implement Constructor take in  a matcher of expected value</li>
<li>Implement matchesSafely(type of thing you are checking against)</li>
<li>Implement describeTo – decorate the existing test result/matcher description…  description.appendText(“WuzUp!”); matcher.describeTo(Description);</li>
<li>Create a Factory Class for your matchers with static factory methods to return a new matcher</li>
<li>Use It</li>
</ol>
<p>Multiple asserts per test are bad (see also Integration Tests are a Scam)</p>
<p>You can combine hamcrest matchers into one test</p>
<p>assertThat(itesm, allOf(hasSize(1), hasItem(“java”)));</p>
<p>assertThat(itesm, hasSize(greaterThan(1)));</p>
<p>The error messages will be cleaner too – expect list size of one, and has item java but received &lt;blah&gt;</p>
<h3>Parameterized Tests</h3>
<p>Usually just one test per Parameterized test class – they get run once</p>
<p>Ways to get test data</p>
<p>Use an xls spreadsheet source</p>
<p>Use Selenium 2’s WebElement to get a webpage</p>
<div id="codeSnippetWrapper">
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@FindBy(name=<span style="color: #006080;">"HD_EN"</span>) WebElement importerName;</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@FindBy(name=<span style="color: #006080;">"HD_EA"</span>) WebElement importerAddress;</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@FindBy(name=<span style="color: #006080;">"HD_ER"</span>) WebElement importerRepresentative;</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;">
</span></pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;">// getters and setters</span></pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;"> </span><span style="color: #008000;">// getter </span><span style="color: #0000ff;">return</span> importerName.getValue();</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;">
</span></pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;">// setter</span>
<span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> setImporterName(String value) {</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">     enter(value, into(importerName));</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">}</pre>
</div>
<p>Smoke test to make sure getters and setters are correct</p>
<p><a href="http://outrospective.org/wordpress/wp-content/uploads/2010/10/image.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://outrospective.org/wordpress/wp-content/uploads/2010/10/image_thumb.png" border="0" alt="image" width="397" height="125" /></a></p>
<p>Make sure the annotations aren’t wrong</p>
<h3>JUnit Rules</h3>
<h4>Delete folders after test run</h4>
<div id="codeSnippetWrapper">
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@Rule public TemporaryFolder folder = <span style="color: #0000ff;">new</span> TemporaryFolder()</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">folder.newFile(“a file name”);</pre>
</div>
<h4>ErrorCollection,</h4>
<p>accumulate errors rather than fail on first.  This saves having to write 20 different tests with large setup that check 20 things on the same page (eg login and load webpage table then verify each cell)</p>
<div id="codeSnippetWrapper">
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@Rule <span style="color: #0000ff;">public</span> ErrorCollector collector = <span style="color: #0000ff;">new</span> ErrorCollector();</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;">// in your test</span></pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;"> </span>collector.addError(<span style="color: #0000ff;">new</span> Throwable(“blah”));</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">collector.addError(<span style="color: #0000ff;">new</span> Throwable(“something <span style="color: #0000ff;">else</span>”));</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">collector.checkThat(result, yourMatcher);</pre>
</div>
<p>The result will show “blah”, “something else” and the result of your failed matcher, as well as fail the test.</p>
<h4>TimeoutRules</h4>
<p>When you know something should have a short response time, a DAO for example should be shorter than 1 second</p>
<div id="codeSnippetWrapper">
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@Rule <span style="color: #0000ff;">public</span> MethodRule globalTimeout = <span style="color: #0000ff;">new</span> Timeout(1000);</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@Test <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> catchInfiniteLoopInTest() { <span style="color: #0000ff;">for</span>(;;); }</pre>
</div>
<p>Catch any major issues before they get into production and become embarassing</p>
<h4>Verifier Rule</h4>
<p>Something that happens after a test is completed, like an assert</p>
<p>Inject behaviour to make JUnit add checks after each test…. kind of like a test post-condition or invariant from Betrand Meyers OO Software construction, but just for the tests themselves.</p>
<div id="codeSnippetWrapper">
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #0000ff;">private</span> List&lt;String&gt; systemErrorMessages = <span style="color: #0000ff;">new</span> ArrayList&lt;String&gt;();</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@Rule</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #0000ff;">public</span> MethodRule verifier = <span style="color: #0000ff;">new</span> Verifier() {</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    @Override</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> verify() {</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        assertThat(systemErrorMessages.size(), is(0));</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    }};</pre>
</div>
<p>A good example I see would be using it to tie up mock verification calls in EasyMock</p>
<h4>Watchman Rule</h4>
<p>Called when a test fails or succeeds.  Additional logging perhaps?  How about restarting a GUI, or take a screenshot when a test fails.</p>
<h3>Categories</h3>
<p>Group tests in your own hierarchy based on your classification of the test rather than writing test suites.  Performance tests  that integration tests.  Slow running or fast running tests?</p>
<p><img src="http://yuml.me/diagram/scruffy/class/%23%20Cool%20UML%20Diagram,%20%5BIntegrationTest%5D%5E-.-%5BPerformance%20Test%5D" alt="" /></p>
<p>You can setup plain old normal interfaces for your categories, and have them extend each other via subclassing.  There is no Junit annotation here to indicate its an interface for testing, so you can potentially use any interface in your source.  I’m not sure if this is good practice or not, but say you wanted all your DAO tests that implemented a GenericDAO to be tested, you could do this…. or how about test all classes that implements Serializable?</p>
<p>You can annotate a test class, or tests methods with @Category(InterfaceName.class)</p>
<p>When running a category suite however you still need to include the classes to inspect as well as the category name.</p>
<div>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@RunWith(Categories.<span style="color: #0000ff;">class</span>)</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@IncludeCategory(PerformanceTests.<span style="color: #0000ff;">class</span>)</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@SuiteClasses( { CellTest.<span style="color: #0000ff;">class</span>, WhenYouCreateANewUniverse.<span style="color: #0000ff;">class</span> })</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> PerformanceTestSuite {}</pre>
</div>
<div>You can also exclude from a Run and run a</div>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@RunWith(Categories.<span style="color: #0000ff;">class</span>)</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@<strong>ExcludeCategory</strong>(PerformanceTests.<span style="color: #0000ff;">class</span>)</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">@SuiteClasses( { CellTest.<span style="color: #0000ff;">class</span>, WhenYouCreateANewUniverse.<span style="color: #0000ff;">class</span> })</pre>
<pre id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> PerformanceTestSuite {}</pre>
<p>But how about scanning your whole test bed?  Can we programmatically inject suite classes and use them with Categories?  At this point it is a limitation unless you want to use a classpath hack.</p>
<h3>Parallel Tests</h3>
<p>If you have fast IO and multicore (like my new work PC <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://outrospective.org/wordpress/wp-content/uploads/2010/10/wlEmoticonsmile.png" alt="Smile" />) and well written tests that don’t trodd on each others data.</p>
<p>U use Maven’s surefire 2.5 plugin to achieve this, and say methods, classes or both in parallel.  Classes is probably safer since most people write the test slipping thru later tests in the same class depend on earlier test methods accidentally.</p>
<h3>Infinitest</h3>
<p>This is a tool for IntelliJ and Eclipse that runs tests when you save your source and tells you if you have failed runs.  I remember twittering about how cool this would be if it existed a while back, and I’m glad I wasnt the only one with this idea and that someone actually implemented it <img class="wlEmoticon wlEmoticon-openmouthedsmile" style="border-style: none;" src="http://outrospective.org/wordpress/wp-content/uploads/2010/10/wlEmoticonopenmouthedsmile.png" alt="Open-mouthed smile" />.</p>
<p>Also there was a plugin for IntelliJ called Fireworks but I could never get it to run tests properly on my Windows PC; always complaining about not being able to find a JDK home <img class="wlEmoticon wlEmoticon-sadsmile" style="border-style: none;" src="http://outrospective.org/wordpress/wp-content/uploads/2010/10/wlEmoticonsadsmile.png" alt="Sad smile" />.</p>
<p>This tool seems pretty cheap at $29 for an individual license, I’ll check it out and give it a shot.</p>
<p><a href="http://improvingworks.com/products/infinitest/">http://improvingworks.com/products/infinitest/</a></p>
<p>What would be super cool is if it worked with Categories mentioned above, to be able to exclude GUI tests from being executed.  There may be a feature in Infinitest that handles it but I’d be keen to see.</p>
<h3>Mockito</h3>
<p>I’m traditionally an EasyMock guy but <a href="http://mockito.org" target="_blank">Mockito</a> has always had good buzz.  At my new job we dont actually have a mocking framework yet so I’m keen to give it a look.</p>
<p>Mockito seems to have less verbose setup of tests, something that when learning EasyMock bashed me around a bit – ever forget to get out of record mode and get a green test accidentally.</p>
<p>As per Integration Tests are a scam ypresso recommends, you can verify interactions, verify a method is being called with certain params.</p>
<h3>Other Stuff (comments from the Q&amp;A of the presso)</h3>
<p>Hibernate mappings – use an in-memory database</p>
<p>FEST asserts – an alternate to Hamcrest that avoids the Generic issues that plague Hamcrest!!! (boy this frustrates me a lot as a Hamcrest user)</p>
<p><a href="http://cobertura.sourceforge.net/" target="_blank">Cobertura</a> – a code coverage tool, alternate to Emma</p>
<p>Private methods shouldn’t be tested explicitly – you should be able to sufficiently test a class by its public facing API.</p>
]]></content:encoded>
			<wfw:commentRss>http://outrospective.org/wordpress/2010/10/junit-kungfu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Presentations</title>
		<link>http://outrospective.org/wordpress/2010/09/testing-presentations/</link>
		<comments>http://outrospective.org/wordpress/2010/09/testing-presentations/#comments</comments>
		<pubDate>Mon, 27 Sep 2010 03:50:49 +0000</pubDate>
		<dc:creator>Kon</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[asynchronous systems]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[techiniques]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://outrospective.org/wordpress/2010/09/testing-presentations/</guid>
		<description><![CDATA[Their has been a presentation I watched last year that absolutely changed my opinion on how I tested and how I designed.&#160; It was one of those presentations that just made sense and I cant believe I haven’t blogged about &#8230; <a href="http://outrospective.org/wordpress/2010/09/testing-presentations/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Their has been a presentation I watched last year that absolutely changed my opinion on how I tested and how I designed.&nbsp; It was one of those presentations that just made sense and I cant believe I haven’t blogged about it until now.
<p><a href="http://www.infoq.com/presentations/integration-tests-scam" target="_blank">Integration Tests are a Scam</a> by Joe Rainsberger
<p>This was my favourite presentation from last year. It talks about writing the correct type of unit tests to get get fast results and reduce the need for slower integration tests that are generally slower are require a lot of maintenance. He makes a compelling argument about the number of tests in your system don’t improve the sense of security you get from your tests by the same amount. So he talks about what needs to be unit tested from the contract class and the opposite collaborator class and how doing so gives you a better picture of what tests you need to give you a sense of security with quick feedback. The blurb explains it better<br />
<blockquote>
<p>Integration tests are a scam. You’re probably writing 2-5% of the integration tests you need to test thoroughly. You’re probably duplicating unit tests all over the place. Your integration tests probably duplicate each other all over the place. When an integration test fails, who knows what’s broken? Learn the two-pronged attack that solves the problem: collaboration tests and contract tests.</p>
</blockquote>
<hr />
<p><a href="http://www.infoq.com/presentations/TDD-of-Asynchronous-Systems" target="_blank">TDD of Asynchronous Systems</a>
<p>This presentation by the author of a new book, “growing object oriented software, guided by tests” Nat Pryce, which talks about testing at the integration/functional level and techniques to get around all the painful ‘flickering tests’ &amp; ‘false positives’ issues that occur when you have them. The examples talk about testing legacy systems, swing gui’s and JMS queues.
<p>One of the key ideas is that one must find a point to synchronise on before executing the assertions and those assertions must wait (and retry if not true) until the state has changed or a timeout occurs (and the test then fails)
<p>As a user of UISpec4j with its Assertions that have a timeout, and some perilious test code when someone innocently mixed junit assertions with a UI test, I could relate to this really well.</p>
]]></content:encoded>
			<wfw:commentRss>http://outrospective.org/wordpress/2010/09/testing-presentations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Junit&#8217;s Theory&#8217;s as interprested by Schauderhaft and Groovy</title>
		<link>http://outrospective.org/wordpress/2010/02/junits-theorys-as-interprested-by-schauderhaft-and-groovy/</link>
		<comments>http://outrospective.org/wordpress/2010/02/junits-theorys-as-interprested-by-schauderhaft-and-groovy/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 07:18:59 +0000</pubDate>
		<dc:creator>Kon</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://portfolio.outrospective.org/wordpress/?p=283</guid>
		<description><![CDATA[JUnit theories sound promising.&#160; Many a time a developer writes a whole lot of @Tests along the lines of testParameterXzero(), testParameterXone(), testParameterXmaxInt(). The test code may be almost identical apart from the parameters being used in the class/method under test &#8230; <a href="http://outrospective.org/wordpress/2010/02/junits-theorys-as-interprested-by-schauderhaft-and-groovy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>JUnit theories sound promising.&#160; Many a time a developer writes a whole lot of <font face="Courier New">@Test</font>s along the lines of <font face="Courier New">testParameterXzero(), testParameterXone(), testParameterXmaxInt().</font> The test code may be almost identical apart from the parameters being used in the class/method under test which is redundant and prone to error.</p>
<p>Theories offer a sound alternate, specifying a single test method, with a different set of annotations to the regular <font face="Courier New">@Test </font> defining a field or annotation based ParameterSupplier to inject a series of values into each test.</p>
<p>  Schauderhaft’s blog provides a great summary of <a href="http://blog.schauderhaft.de/2010/01/31/new-feature-of-junit-theories/" target="_blank">what theories are</a> and <a href="http://blog.schauderhaft.de/2010/02/07/junit-theories/" target="_blank">how to write a parameter supplier to supply a series of datapoints</a> in Java.  The annotation based ParameterSupplier does look a little verbose but as Schauderhaft points out, they can be reused &#8211; annotation based data fixtures &#8211; excellent.  I liked these two posts because they do a better job at explaining than the release notes.  The blog also links to a blog about another Junit4 feature &#8211; <a href="http://ourcraft.wordpress.com/2008/08/27/writing-a-parameterized-junit-test/" target="_blank">parameterised tests</a> &#8211; that seem to be a precursor to Theories, and a little simpler to setup.  Another great source of how to use Theories is actually in the <a href="http://groovy.codehaus.org/Using+JUnit+4+with+Groovy" target="_blank">Groovy documentation about Junit integration</a>.  Closures make Datapoints a little more concise (or maybe the example is just simpler? hehe) along with the fact that test data (lists,maps) have a groovy conciseness to them to begin with.</p>
]]></content:encoded>
			<wfw:commentRss>http://outrospective.org/wordpress/2010/02/junits-theorys-as-interprested-by-schauderhaft-and-groovy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UML and CRC and Agile References</title>
		<link>http://outrospective.org/wordpress/2008/06/uml-and-crc-and-agile-references/</link>
		<comments>http://outrospective.org/wordpress/2008/06/uml-and-crc-and-agile-references/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 08:13:15 +0000</pubDate>
		<dc:creator>Kon</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://portfolio.outrospective.org/wordpress/?p=226</guid>
		<description><![CDATA[CRC Cards (Class Responsibility Collaborator cards) Class Name Responsibilities Collaborators A very good UML diagram reference (I may have referenced this one before). http://www.agilemodeling.com/essays/umlDiagrams.htm And a page of useful agile resources, from a process standpoint. http://www.agilelogic.com/sp_resources.html I particularly like the &#8230; <a href="http://outrospective.org/wordpress/2008/06/uml-and-crc-and-agile-references/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.agilemodeling.com/artifacts/crcModel.htm" target="_blank">CRC Cards</a> (Class Responsibility Collaborator cards)</p>
<table cellspacing="0" cellpadding="2" width="400" border="1">
<tbody>
<tr>
<td valign="top" colspan="2">Class Name</td>
</tr>
<tr>
<td valign="top" width="199">Responsibilities</td>
<td valign="top" width="199">Collaborators</td>
</tr>
</tbody>
</table>
<p>A very good UML diagram reference (I may have referenced this one before).</p>
<p><a title="http://www.agilemodeling.com/essays/umlDiagrams.htm" href="http://www.agilemodeling.com/essays/umlDiagrams.htm">http://www.agilemodeling.com/essays/umlDiagrams.htm</a></p>
<p>And a page of useful agile resources, from a process standpoint.</p>
<p><a title="http://www.agilelogic.com/sp_resources.html" href="http://www.agilelogic.com/sp_resources.html">http://www.agilelogic.com/sp_resources.html</a></p>
<p>I particularly like the ones about <a href="http://www.agilelogic.com/20071226.html" target="_blank">Missing the Point of the Daily Stand-Up?</a> and <a href="http://www.agilelogic.com/files/ExtremeProgrammingPerspectivesCh30.pdf" target="_blank">eXtreme Adoption eXperiences of a B2B Start Up</a></p>
<p>The <a href="http://www.objectmentor.com/resources/articles/SelfShunPtrn.pdf" target="_blank">Self-Shunt unit testing pattern</a> in short is a way to think about your tests so that you are not testing more than one thing in a test. It talks about passing the object you are testing to itself. Here is a quote (paraphrased) from the document about when to use it &quot;Methods such as testScanAndDisplay scream testing two things.&quot;</p>
]]></content:encoded>
			<wfw:commentRss>http://outrospective.org/wordpress/2008/06/uml-and-crc-and-agile-references/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AssumeThat(flexibleJunitTesting.withMatchers(), isGreat());</title>
		<link>http://outrospective.org/wordpress/2008/06/assumethatflexiblejunittestingwithmatchers-isgreat/</link>
		<comments>http://outrospective.org/wordpress/2008/06/assumethatflexiblejunittestingwithmatchers-isgreat/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 09:37:48 +0000</pubDate>
		<dc:creator>Kon</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://portfolio.outrospective.org/wordpress/?p=223</guid>
		<description><![CDATA[I&#8217;ve seen Matchers used in EasyMock but I kinda stumbled across the assertThat method in JUnit today and realised how powerful this stuff can be. Usage: assertThat(&#8220;You Failed&#8221;, testValue, allOff(greaterThan(3), lessThan(6)) They seem a lot simpler in this context even &#8230; <a href="http://outrospective.org/wordpress/2008/06/assumethatflexiblejunittestingwithmatchers-isgreat/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen Matchers used in EasyMock but I kinda stumbled across the <em>assertThat</em> method in JUnit today and realised how powerful this stuff can be.</p>
<p><strong>Usage</strong>:<br />
<font face="Courier">assertThat(&#8220;You Failed&#8221;, testValue, allOff(greaterThan(3), lessThan(6))</font></p>
<p>They seem a lot simpler in this context even though they are the same thing.</p>
<p>The Matchers are taken from a project called Hamcrest which both JUnit, various xMock and other testing frameworks have all jumped on board to.</p>
<p>Hamcrest comes with a library of useful matchers. Here are some of the most important ones.</p>
<ul>
<li><font size="1">Core </font>
<ul>
<li><font size="1"><tt>anything</tt> &#8211; always matches, useful if you don&#8217;t care what the object under test is </font></li>
<li><font size="1"><tt>describedAs</tt> &#8211; decorator to adding custom failure description </font></li>
<li><font size="1"><tt>is</tt> &#8211; decorator to improve readability &#8211; see &#8220;Sugar&#8221;, below </font></li>
</ul>
</li>
<li><font size="1">Logical </font>
<ul>
<li><font size="1"><tt>allOf</tt> &#8211; matches if all matchers match, short circuits (like Java &#038;&#038;) </font></li>
<li><font size="1"><tt>anyOf</tt> &#8211; matches if any matchers match, short circuits (like Java ||) </font></li>
<li><font size="1"><tt>not</tt> &#8211; matches if the wrapped matcher doesn&#8217;t match and vice versa </font></li>
</ul>
</li>
<li><font size="1">Object </font>
<ul>
<li><font size="1"><tt>equalTo</tt> &#8211; test object equality using Object.equals </font></li>
<li><font size="1"><tt>hasToString</tt> &#8211; test Object.toString </font></li>
<li><font size="1"><tt>instanceOf</tt>, <tt>isCompatibleType</tt> &#8211; test type </font></li>
<li><font size="1"><tt>notNullValue</tt>, <tt>nullValue</tt> &#8211; test for null </font></li>
<li><font size="1"><tt>sameInstance</tt> &#8211; test object identity </font></li>
</ul>
</li>
<li><font size="1">Beans </font>
<ul>
<li><font size="1"><tt>hasProperty</tt> &#8211; test JavaBeans properties </font></li>
</ul>
</li>
<li><font size="1">Collections </font>
<ul>
<li><font size="1"><tt>array</tt> &#8211; test an array&#8217;s elements against an array of matchers </font></li>
<li><font size="1"><tt>hasEntry</tt>, <tt>hasKey</tt>, <tt>hasValue</tt> &#8211; test a map contains an entry, key or value </font></li>
<li><font size="1"><tt>hasItem</tt>, <tt>hasItems</tt> &#8211; test a collection contains elements </font></li>
<li><font size="1"><tt>hasItemInArray</tt> &#8211; test an array contains an element </font></li>
</ul>
</li>
<li><font size="1">Number </font>
<ul>
<li><font size="1"><tt>closeTo</tt> &#8211; test floating point values are close to a given value </font></li>
<li><font size="1"><tt>greaterThan</tt>, <tt>greaterThanOrEqualTo</tt>, <tt>lessThan</tt>, <tt>lessThanOrEqualTo</tt> &#8211; test ordering </font></li>
</ul>
</li>
<li><font size="1">Text </font>
<ul>
<li><font size="1"><tt>equalToIgnoringCase</tt> &#8211; test string equality ignoring case </font></li>
<li><font size="1"><tt>equalToIgnoringWhiteSpace</tt> &#8211; test string equality ignoring differences in runs of whitespace </font></li>
<li><font size="1"><tt>containsString</tt>, <tt>endsWith</tt>, <tt>startsWith</tt> &#8211; test string matching</font></li>
</ul>
</li>
</ul>
<p align="left">Here is a summary of Matchers from the <a target="_blank" href="http://code.google.com/p/hamcrest/wiki/Tutorial">Hamcrest tutorial page</a>.  They may not all be in JUnit.  JUnit ships with <code>org.hamcrest.CoreMatchers</code> and <code>org.junit.matchers.JUnitMatchers.</code></p>
<h3>Assumptions</h3>
<p>Assumptions are like <em>@Ignore</em>-ing tests programmatically.  They are a test, intended to determine that the environment a test is running in, will successfully run the test.  The example from the <a target="_blank" href="http://junit.sourceforge.net/doc/ReleaseNotes4.4.html">JUnit 4.4 release notes</a> best illustrates this:</p>
<pre><code>import static org.junit.Assume.*  </code></pre>
<pre><code>@Test public void filenameIncludesUsername() {
assumeThat(File.separatorChar, is('/'));
assertThat(new User("optimus").configFileName(),
</code><code>is("configfiles/optimus.cfg"));
}</code></pre>
<p>If the expression in the assume statement fails, then the test will be marked as passed.  Apparently in future, the failed assumption may lead to the test being marked as ignored which would be excellent.</p>
<p><strong>Edit:</strong> Another useful resource is the <a href="http://junit.org/apidocs/org/junit/matchers/JUnitMatchers.html">Junit API on Matcher</a>s</p>
]]></content:encoded>
			<wfw:commentRss>http://outrospective.org/wordpress/2008/06/assumethatflexiblejunittestingwithmatchers-isgreat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Fit</title>
		<link>http://outrospective.org/wordpress/2008/05/get-fit/</link>
		<comments>http://outrospective.org/wordpress/2008/05/get-fit/#comments</comments>
		<pubDate>Tue, 06 May 2008 17:42:04 +0000</pubDate>
		<dc:creator>Kon</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://portfolio.outrospective.org/wordpress/?p=220</guid>
		<description><![CDATA[Fit is a framework that helps the business get involved in specifying the requirements that end up being the testing.&#160; When the business can use Word and Excel to generate their own test cases, connected to a simple fixture and &#8230; <a href="http://outrospective.org/wordpress/2008/05/get-fit/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Fit is a framework that helps the business get involved in specifying the requirements that end up being the testing.&#160; When the business can use Word and Excel to generate their own test cases, connected to a simple fixture and can be run by developers, customers and managers on demand, the potential for something great arises.</p>
<p>Encouraging the business to get involved at an early stage means that the business refine their requirements further.</p>
<p>Fit Tests can tell us useful things.&#160; Where a FIT test fails, its an indicator that we need more code to cover business requirements.</p>
<p>Fit complements xUnit, the fixtures are similar but the test data, state and structure is all defined in the business supplied doco&#8217;s.&#160; The fixtures are simply glue from these documents to the tests.</p>
<p><a href="http://www.infoq.com/presentations/AutomatingBusinessValuewithFITandFitnesse" target="_blank">Automating Business Value with FIT and Fitnesse</a> from InfoQ</p>
<p><a href="http://fit.c2.com/" target="_blank">Fit: Framework for Integrated Test</a></p>
<p>And when regular XP wont do, get <a href="http://industrialxp.org/index.html" target="_blank"><strong>Industrial XP</strong></a><strong>.&#160; </strong>Nothing to do with FIT, just a site mentioned in the first link.</p>
]]></content:encoded>
			<wfw:commentRss>http://outrospective.org/wordpress/2008/05/get-fit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Now for something Obvious</title>
		<link>http://outrospective.org/wordpress/2008/05/now-for-something-obvious/</link>
		<comments>http://outrospective.org/wordpress/2008/05/now-for-something-obvious/#comments</comments>
		<pubDate>Mon, 05 May 2008 12:30:55 +0000</pubDate>
		<dc:creator>Kon</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://portfolio.outrospective.org/wordpress/?p=219</guid>
		<description><![CDATA[In this presentation about FIT, the presenter, David, takes a look at the meaning of the term &#8216;the build is broken&#8217;.&#160; What it is now compared to 10 years ago.&#160; He states that as technologists we should be proud that &#8230; <a href="http://outrospective.org/wordpress/2008/05/now-for-something-obvious/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In this <a href="http://www.infoq.com/presentations/AutomatingBusinessValuewithFITandFitnesse" target="_blank">presentation about FIT</a>, the presenter, David, takes a look at the meaning of the term &#8216;the build is broken&#8217;.&#160; What it is now compared to 10 years ago.&#160; He states that as technologists we should be proud that we&#8217;ve evolved the meaning from the literal code broke, won&#8217;t compile, to now a meaning saying that the tests are broken.&#160; </p>
<p>Given that in Eclipse, I&#8217;m told in almost realtime where compilation errors occur as I write them, and how this acheives high build success rate, I wonder if Eclipse can precompile and debug JUnit tests so that as we are changing code that is used in a test class, the test runs and the results are fed back in almost realtime, allowing us to pickup on even more potential hazards.</p>
<p>Lots of pitfalls for the cynical but its so crazy it just may work.</p>
]]></content:encoded>
			<wfw:commentRss>http://outrospective.org/wordpress/2008/05/now-for-something-obvious/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swing Explorer</title>
		<link>http://outrospective.org/wordpress/2007/07/swing-explorer/</link>
		<comments>http://outrospective.org/wordpress/2007/07/swing-explorer/#comments</comments>
		<pubDate>Wed, 18 Jul 2007 01:57:19 +0000</pubDate>
		<dc:creator>Kon</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://portfolio.outrospective.org/wordpress/?p=192</guid>
		<description><![CDATA[Initially Swing Explorer looked like it was the one size fits all solution to replace QTP. Ok, I was a bit nieve, its more aiken to the Object Spy of QTP, allowing to see the heirachy of a Java object &#8230; <a href="http://outrospective.org/wordpress/2007/07/swing-explorer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Initially <a href="https://swingexplorer.dev.java.net/#User_Documentation">Swing Explorer</a> looked like it was the one size fits all solution to replace QTP.</p>
<p>Ok, I was a bit nieve, its more aiken to the Object Spy of QTP, allowing to see the heirachy of a Java object just by clicking it.</p>
<p>The neatest thing it has though is a Player to help diagnose the drawing an layout of your objects.  I thought this was a player, ala QTP recording and playback, but no, its a different kind but still very useful if you are trying to debug layout in a Swing app.</p>
]]></content:encoded>
			<wfw:commentRss>http://outrospective.org/wordpress/2007/07/swing-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sexy NUnit Runner</title>
		<link>http://outrospective.org/wordpress/2007/05/sexy-nunit-runner/</link>
		<comments>http://outrospective.org/wordpress/2007/05/sexy-nunit-runner/#comments</comments>
		<pubDate>Sun, 20 May 2007 16:42:41 +0000</pubDate>
		<dc:creator>Kon</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://portfolio.outrospective.org/wordpress/?p=183</guid>
		<description><![CDATA[ReSharper UnitRun is a plugin for VS.NET and its the best looking NUnit (or JUnit tool) I&#8217;ve seen to date.  ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jetbrains.com/unitrun/download/">ReSharper UnitRun</a> is a plugin for VS.NET and its the best looking NUnit (or JUnit tool) I&#8217;ve seen to date.</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://outrospective.org/wordpress/2007/05/sexy-nunit-runner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Squish &#8211; An automated UI testing tool for Java</title>
		<link>http://outrospective.org/wordpress/2007/02/squish-an-automated-ui-testing-tool-for/</link>
		<comments>http://outrospective.org/wordpress/2007/02/squish-an-automated-ui-testing-tool-for/#comments</comments>
		<pubDate>Thu, 15 Feb 2007 00:37:29 +0000</pubDate>
		<dc:creator>Kon</dc:creator>
				<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://portfolio.outrospective.org/wordpress/?p=147</guid>
		<description><![CDATA[New (for Java) Automated UI testing tool. Supports Mercury Quality Center integration. Can write your scripts in JavaScript, Perl, Tkl. http://www.froglogic.com/pg?id=Products&#038;category=squish&#038;sub=editions&#038;subsub=java And when you want to change all your vbscript scripts to JavaScript, you could use this]]></description>
			<content:encoded><![CDATA[<p>New (for Java) Automated UI testing tool.  Supports Mercury Quality Center integration. Can write your scripts in JavaScript, Perl, Tkl.</p>
<p><a href="http://www.froglogic.com/pg?id=Products&#038;category=squish&#038;sub=editions&#038;subsub=java">http://www.froglogic.com/pg?id=Products&#038;category=squish&#038;sub=editions&#038;subsub=java</a></p>
<p>And when you want to change all your vbscript scripts to JavaScript, you could use <a href="http://slingfive.com/pages/code/scriptConverter/">this</a></p>
]]></content:encoded>
			<wfw:commentRss>http://outrospective.org/wordpress/2007/02/squish-an-automated-ui-testing-tool-for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

