<?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>AlecMcE.com &#187; Unit Testing</title>
	<atom:link href="http://alecmce.com/tag/unit-testing/feed" rel="self" type="application/rss+xml" />
	<link>http://alecmce.com</link>
	<description>Coding on the Flash Platform</description>
	<lastBuildDate>Thu, 12 Aug 2010 21:32:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ASUnit Gotcha &#8211; Empty TestSuite Bug</title>
		<link>http://alecmce.com/as3/asunit-gotcha-empty-testsuite-bug</link>
		<comments>http://alecmce.com/as3/asunit-gotcha-empty-testsuite-bug#comments</comments>
		<pubDate>Sun, 02 Aug 2009 22:21:33 +0000</pubDate>
		<dc:creator>alec</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[Test Driven Development]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://alecmce.com/?p=160</guid>
		<description><![CDATA[This afternoon I discovered an interesting little bug in the ASUnit library which causes the TestRunner never to finish its suite of unit tests. It is fairly straightforward to reproduce too: simply, add create a TestSuite that doesn&#8217;t contain any tests and add the suite to the runner. Though I have created an artificial example [...]]]></description>
			<content:encoded><![CDATA[<p>This afternoon I discovered an interesting little bug in the <a href="http://asunit.org/">ASUnit library</a> which causes the <code>TestRunner</code> never to finish its suite of unit tests. It is fairly straightforward to reproduce too: simply, add create a <code>TestSuite</code> that doesn&#8217;t contain any tests and add the suite to the runner.</p>
<p>Though I have created an artificial example to isolate the problem, it arose in a real-world situation. I had two package folders in which I intended to create tests. I created all the <code>AllTest</code> <code>TestSuite</code>s but only populated one of the packages with tests. When I tried to run the <code>TestRunner</code> to see the results of these tests, though they appeared to have run the <code>TestRunner</code> had never completed.</p>
<p>The source of the problem lies in the architecture of the <code>TestSuite</code> class, the main functionality for which is launched by the <code>run</code> method but which dispatches an event to indicate that it has finished performing tests in its <code>testCompleteHandler</code> method. However, <code>testCompleteHandler</code> can only ever be triggered as a consequence of a test completing in <code>run</code>, so if no tests are defined, the <code>TestSuite</code> never finishes.</p>
<h2>Update</h2>
<p>I posted my resolution of this problem on github, but it has since been merged to the asunit trunk, so I have removed the github repository. My solution added checks for empty <code>TestCase</code>s and <code>TestSuite</code>s to prevent the <code>TestRunner</code> trying to run them.</p>
]]></content:encoded>
			<wfw:commentRss>http://alecmce.com/as3/asunit-gotcha-empty-testsuite-bug/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
