<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>patrickmowrer.com</title>
    <description></description>
    <link>http://patrickmowrer.com/</link>
    <atom:link href="http://patrickmowrer.com/feed.xml" rel="self" type="application/rss+xml" />
    
      <item>
        <title>Multiple thumb Spark Slider v. 0.1.3.</title>
        <description>&lt;p&gt;Some way-overdue bug fixes have been made to the multiple-thumb Spark slider component. Thanks to those reporting issues! Please let me know if there’s anything else that needs fixing; promise it won’t take another year. Find the new version on &lt;a href=&quot;http://github.com/pmowrer/spark-components&quot; title=&quot;pmowrer&#39;s spark-components at master - GitHub&quot;&gt;Github&lt;/a&gt;. Change list for version 0.1.3 below:&lt;!--break--&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Fixed bug giving thumbs NaN value when min and max are set to same value.&lt;/li&gt;
  &lt;li&gt;Fixed bug where setting minimum and maximum at same time could limit either based on previous minimum/maximum value.&lt;/li&gt;
  &lt;li&gt;Fixed bug where clicking on track in a negative value range would cause null exception.&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Sun, 07 Oct 2012 00:00:00 +0000</pubDate>
        <link>http://patrickmowrer.com/2012/10/07/multiple-thumb-spark-slider-v-013/</link>
        <guid isPermaLink="true">http://patrickmowrer.com/2012/10/07/multiple-thumb-spark-slider-v-013/</guid>
      </item>
    
      <item>
        <title>FlexUnit4-testing with morefluent-signals</title>
        <description>&lt;p&gt;Some time ago I wrote about &lt;a href=&quot;/2010/08/19/improving-readability-of-asynchronous-tests-in-flexunit4-using-hamcrest-matchers/&quot; title=&quot;Improving readability of asynchronous tests in FlexUnit4 using Hamcrest matchers&quot;&gt;improving the readability of asynchronous FlexUnit4 tests&lt;/a&gt;, which typically suffer from being broken up on multiple function blocks and from the terse method names of the &lt;code&gt;Async&lt;/code&gt; helper class. To address it, I wrote a &lt;a href=&quot;https://github.com/pmowrer/hamcrest-as3-async&quot;&gt;library of asynchronous
matchers&lt;/a&gt; intended to be used with &lt;a href=&quot;https://github.com/drewbourne/hamcrest-as3&quot; title=&quot;hamcrest-as3&quot;&gt;hamcrest-as3&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Soon thereafter, I was made aware of the existence of Kris Karczmarczyk’s excellent library &lt;a href=&quot;https://bitbucket.org/loomis/morefluent/wiki/Home&quot; title=&quot;morefluent&quot;&gt;morefluent&lt;/a&gt;, already addressing all of the issues I aimed to correct in my own library, and more. It has since become one of the swcs I always drop into my libs folder when I start a test project, along with other givens like hamcrest-as3 and FlexUnit4. Quite frankly, its a disgrace this library has only been downloaded some 60 or so times across its version history (according to BitBucket’s stats), but that probably says more about the prevalence of unit testing within the Flex/Flash community than anything else.&lt;!--break--&gt;&lt;/p&gt;

&lt;p&gt;For my latest project, I’ve almost exclusively moved over to using as3-signals over Flash’s native events. However, morefluent only works with events, and there isn’t much in the way of alternatives. There’s a library wrapping FlexUnit4’s &lt;code&gt;Async&lt;/code&gt; for use with as3-signals, &lt;a href=&quot;https://github.com/eidiot/as3-signals-utilities-async/&quot; title=&quot;as3-signals-utilities-async&quot;&gt;as3-signals-utilities-async&lt;/a&gt;, enabling asynchronous signal testing, but writing tests with it is no different than
using regular &lt;code&gt;Async&lt;/code&gt;; the readability issues remain (by design, of course). Sacrificing test readability not being an option, I decided to marry morefluent with as3-signals-utilities-async, creating &lt;a href=&quot;https://github.com/pmowrer/morefluent-signals&quot; title=&quot;morefluent-signals&quot;&gt;morefluent-signals&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To illustrate my point, this is how the first example from &lt;a href=&quot;https://github.com/eidiot/as3-signals-utilities-async/blob/master/README.textile&quot; title=&quot;as3-signals-utilities-async README.textile&quot;&gt;as3-signals-utilities-readme&lt;/a&gt; reads:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;change_user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;IModel&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SomeModel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;handleSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;changedSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;verify_user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;  
        &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Tom&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;changeUser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Tom&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;verify_user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;SignalAsyncEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;):&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;assertEquals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;assertEquals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is how the same example reads with morefluent-signals:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;change_user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;IModel&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SomeModel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;changeUser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Tom&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;changedSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;assertOnArguments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Tom&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here are a few more examples of how you can use morefluent-signals to assert that…&lt;/p&gt;

&lt;p&gt;… an asynchronous signal was never dispatched:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;asyncSignalWasNeverDispatched&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;asyncSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;… an asynchronous signal was dispatched with given arguments:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;asynchSignalWasDispatchedWithArgs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;asyncSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;assertOnArguments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;anything&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()]);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;… a synchronous singal was dispatched x number of times:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;syncSignalWasDispatchedTwice&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;observing&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;syncSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;syncSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;syncSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;assert&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;syncSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dispatched&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;times&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;… a synchronous signal was dispatched with given arguments:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;syncSignalWasDispatchedWithArguments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;observing&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;syncSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;syncSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;string&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;123&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;assert&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;syncSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dispatched&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;withArguments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;string&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;123&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Download &lt;a href=&quot;https://github.com/pmowrer/morefluent-signals&quot; title=&quot;morefluent-signals&quot;&gt;morefluent-signals on Github&lt;/a&gt; and let me know what you think. I’m more than happy to address any issues you come across or considering any new features that makes your testing easier.&lt;/p&gt;
</description>
        <pubDate>Fri, 04 Mar 2011 00:00:00 +0000</pubDate>
        <link>http://patrickmowrer.com/2011/03/04/flexunit4-testing-morefluent-signals/</link>
        <guid isPermaLink="true">http://patrickmowrer.com/2011/03/04/flexunit4-testing-morefluent-signals/</guid>
      </item>
    
      <item>
        <title>Multiple thumb Spark Slider v. 0.1.1</title>
        <description>&lt;p&gt;A new version of the multiple thumb Spark Slider is now available on &lt;a href=&quot;http://github.com/pmowrer/spark-components&quot; title=&quot;pmowrer&#39;s spark-components at master - GitHub&quot;&gt;Github&lt;/a&gt;. This version doesn’t add any new major features, but polishes up existing behavior. Regrettably, I’ve had very little time to work on it since releasing the first version; I hope to get to adding new features soon enough. For now, see the change-list below for updates in version 0.1.1:&lt;!--break--&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Refactored HorizontalValueLayout and VerticalValueLayout into LinearValueLayout. This should enable easy creation of sliders between any two points, not just horizontal and vertical planes.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Added element alignment to value layouts, enabling the Slider thumb to be positioned over its value in any way desired. Constants classes provide convenience values for layouts, used by the HSlider and VSlider classes.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Renamed ThumbDragEvent to ThumbMouseEvent, and two if its types from BEGIN_DRAG and END_DRAG to PRESS and RELEASE respectively. This was done in order to be more consistent with the core Flex components and to better describe the event.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Made ThumbMouseEvents bubble such that event listeners won’t need to be added to individual thumbs, but can be listened to on the Slider component.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Tue, 22 Feb 2011 00:00:00 +0000</pubDate>
        <link>http://patrickmowrer.com/2011/02/22/multiple-thumb-spark-slider-v-011/</link>
        <guid isPermaLink="true">http://patrickmowrer.com/2011/02/22/multiple-thumb-spark-slider-v-011/</guid>
      </item>
    
      <item>
        <title>A multiple thumb Spark Slider component</title>
        <description>&lt;p&gt;After coming across a &lt;a href=&quot;http://forums.adobe.com/message/3063304&quot; title=&quot;Multiple thumbs in hslider for flex4&quot;&gt;few&lt;/a&gt; community &lt;a href=&quot;http://stackoverflow.com/questions/2677822&quot; title=&quot;Flex 4 Slider with two thumbs&quot;&gt;requests&lt;/a&gt; for a Spark Slider component with multiple thumbs, I decided building one would be a nice little side-project, perhaps with the added bonus of improving on my understanding of the Spark component architecture in the process. After all, how hard could it be? It’s just another couple of thumbs, right?&lt;/p&gt;

&lt;p&gt;Turns out it wasn’t quite as easy as I had imagined, perhaps the reason there isn’t already a few of these floating around out there (or is there?). The Spark Slider is a nice component, but also a beast with a long inheritance chain (&lt;code&gt;SkinnableComponent&lt;/code&gt; -&amp;gt; &lt;code&gt;Range&lt;/code&gt; -&amp;gt; &lt;code&gt;TrackBase&lt;/code&gt; -&amp;gt; &lt;code&gt;SliderBase&lt;/code&gt;) and tightly coupled skin parts. &lt;code&gt;Range&lt;/code&gt; is nothing but logic and would be a nice utility to make use of; sadly it inherits from &lt;code&gt;SkinnableComponent&lt;/code&gt;. The layout is
inexplicably baked into &lt;code&gt;HSlider&lt;/code&gt; and &lt;code&gt;VSlider&lt;/code&gt;, making it impossible to add any behavior up the inheritance chain without the need to re-create those classes (copy/paste, of course, just like skins!).&lt;!--break--&gt;&lt;/p&gt;

&lt;p&gt;That said, perhaps there’s a good reason the original Spark component was written in that fashion. Either way, the implementation of this new Slider takes a lot of the existing Spark Slider code, cleans it up some and factors it out into more manageable bits. Layout is handled by a &lt;code&gt;ValueLayout&lt;/code&gt; implementation, making it possible to create, for example, a &lt;code&gt;CircularSlider&lt;/code&gt; without having to extend &lt;code&gt;SliderBase&lt;/code&gt;. Some of the Halo Slider behavior is also there, like &lt;code&gt;allowOverlap&lt;/code&gt;, and some isn’t, like having both &lt;code&gt;value&lt;/code&gt; and &lt;code&gt;values&lt;/code&gt; properties. I think it’s a good start, but I’ll let you be the judge. Check out the live comparison between the new Slider and those of Halo and Spark below.&lt;/p&gt;

&lt;div id=&quot;sliders&quot;&gt;
&lt;/div&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js&quot;&gt;
&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
    swfobject.embedSWF(&quot;/swf/sliders-demo/Sliders.swf&quot;, &quot;sliders&quot;, &quot;550&quot;, &quot;650&quot;, &quot;10.0.0&quot;); 
&lt;/script&gt;

&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;
&lt;p&gt;As you’d expect, there are &lt;code&gt;HSlider&lt;/code&gt; and &lt;code&gt;VSlider&lt;/code&gt; convenience classes available. Neither define any logic, but are simply placeholders for a couple of style properties. For example, &lt;code&gt;HSlider&lt;/code&gt; is equivalent to:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ns&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SliderBase&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;skinClass&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;com.patrickmowrer.skins.HSliderSkin&amp;quot;&lt;/span&gt;  
&lt;span class=&quot;n&quot;&gt;dataTipOffsetY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;-25&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The docs are currently absent, but hopefully it should be straightforward enough as I’ve tried to mimic desirable behaviors of the Halo and Spark components. From there, I intend to add additional functionality like &lt;a href=&quot;http://dougmccune.com/blog/2007/01/21/draggable-slider-component-for-flex/&quot; title=&quot;Draggable Slider Component for Flex&quot;&gt;Doug McCune’s Draggable Slider&lt;/a&gt;. For now, please feel free to download the component from the &lt;a href=&quot;http://github.com/pmowrer/spark-components&quot; title=&quot;pmowrer&#39;s spark-components at master - GitHub&quot;&gt;Github repository&lt;/a&gt; and let me know of any questions/issues.&lt;/p&gt;
</description>
        <pubDate>Mon, 18 Oct 2010 00:00:00 +0000</pubDate>
        <link>http://patrickmowrer.com/2010/10/18/multiple-thumb-spark-slider-component/</link>
        <guid isPermaLink="true">http://patrickmowrer.com/2010/10/18/multiple-thumb-spark-slider-component/</guid>
      </item>
    
      <item>
        <title>Improving readability of asynchronous tests in FlexUnit4 using Hamcrest matchers</title>
        <description>&lt;p&gt;Inspired by the book &lt;a href=&quot;http://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627&quot; title=&quot;Growing Object-Oriented Software, Guided by Tests at Amazon.com&quot;&gt;Growing Object-Oriented Software, Guided by Tests&lt;/a&gt;, I’ve been working on improving how well my AS3/Flex tests read, both in terms of the test code itself as well as the diagnostics, the error description of failed tests. The goal is to make tests read more like plain English and, most importantly, better
convey their intent. To this end, the &lt;a href=&quot;http://code.google.com/p/hamcrest/&quot; title=&quot;Hamcrest at Google Code&quot;&gt;Hamcrest&lt;/a&gt; library is excellent, providing matchers to make test code more expressive and expectations and errors more descriptive. Thankfully, Hamcrest has been around for some time for AS3, &lt;a href=&quot;http://github.com/drewbourne/hamcrest-as3&quot; title=&quot;drewbourne&#39;s hamcrest-as3 at Github.com&quot;&gt;ported from Java by Drew Bourne&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After applying many of the techniques found in the book, I still found my tests lacking readibility when making assertions on asynchronous behavior. &lt;a href=&quot;http://docs.flexunit.org/index.php?title=Writing_an_AsyncTest&quot; title=&quot;FlexUnit4: Writing an AsyncTest&quot;&gt;FlexUnit4 allows for asynchronous testing&lt;/a&gt; of events with the help of the Async class, and while the functionality is good, the tests generally don’t read so well. Bitten by the Hamcrest-matcher-writing bug, I decided to wrap the
behavior of the Async class in Hamcrest matchers, creating a &lt;a href=&quot;http://github.com/pmowrer/hamcrest-as3-async/&quot; title=&quot;pmowrer&#39;s hamcrest-as3-async at GitHub.com&quot;&gt;hamcrest-as3-async library&lt;/a&gt;. Though this may be stretching the definition of a matcher, I like what I’ve come up with thus far. Here are a few before-and-after examples to consider:&lt;!--break--&gt;&lt;/p&gt;

&lt;h3 id=&quot;event-dispatchment&quot;&gt;Event dispatchment&lt;/h3&gt;
&lt;p&gt;Even such a simple test as determining wheter an event has been dispatched doesn’t read anything like the fairly descriptive name of the test (i.e. the function name):&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dispatchesAnEventOfTypeTest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;Async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;proceedOnEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

   &lt;span class=&quot;n&quot;&gt;dispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatchEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Event&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Should it fail, Async’s error description isn’t overly informative:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Error: Timeout Occurred before expected event.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Alright, maybe I’m getting picky here, but we can do better. Instead, using a Hamcrest matcher:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dispatchesAnEventOfTypeTest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;assertAsynchronouslyThat&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dispatchesEventOfType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

   &lt;span class=&quot;n&quot;&gt;dispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatchEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Event&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The test now reads more like the name of the test. Should it fail, it also does so more informatively:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Error: Expected: Event of type “test” was dispatched but: Event of type “test” wasn’t dispatched (timed out after &amp;lt;500&amp;gt; ms)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As you can see, the length of the timeout is mentioned in the error description, a value Async allows you to customize. Using a chained method call, &lt;code&gt;beforeTimeoutAt&lt;/code&gt;, I’ve made it applicable to the matcher as well. The following sets the timeout to 1000 ms (instead of 500 ms by default):&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;n&quot;&gt;assertAsynchronouslyThat&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dispatchesEventOfType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;beforeTimeoutAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id=&quot;quirks&quot;&gt;Quirks&lt;/h3&gt;
&lt;p&gt;Before we go further, a couple of quick gotchas: 
1. Like the Async class and unlike regular Hamcrest matchers, an asynchronous matcher must be declared before the event it listens for is dispatched. 
2. You may not have noticed, but the last argument passed to &lt;code&gt;assertAsynchronouslyThat&lt;/code&gt; is &lt;code&gt;this&lt;/code&gt;. It must be passed an instance of the test case it is executing in as Async depends on that information. This is a bit ugly and surely a potential source of errors as it is easily forgotten and left off. Unfortunately, I’m currently not aware of a way around this.&lt;/p&gt;

&lt;h3 id=&quot;event-data&quot;&gt;Event data&lt;/h3&gt;
&lt;p&gt;Asserting on event data with Async is when readability really starts to suffer. A callback is required, forcing the test code to be broken up into two blocks. This means assertions are often being made in a second, separate function block, making the flow of the test difficult to follow. This can be remedied somewhat by nesting functions, but readability is still poor:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dispatchesAnEventOfTypeTestWithData&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;Async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;handleEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;assertDataIsEqualToValue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

   &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;assertDataIsEqualToValue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;DataEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;):&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;assertThat&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hasProperty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;data&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;equalTo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)));&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

   &lt;span class=&quot;n&quot;&gt;dispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatchEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;DataEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The following is an identical test, only it’s written declaratively using an asynchronous Hamcrest matcher:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dispatchesAnEventOfTypeTestWithData&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;assertAsynchronouslyThat&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dispatchesEventOfType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;which&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hasProperty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;data&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;equalTo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))),&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

   &lt;span class=&quot;n&quot;&gt;dispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatchEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;DataEvent&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Using the chained &lt;code&gt;which&lt;/code&gt; method call, regular Hamcrest matchers can be added to match against the dispatched event.&lt;/p&gt;

&lt;h3 id=&quot;signals&quot;&gt;Signals&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://www.github.com/robertpenner/as3-signals&quot; title=&quot;AS3 Signals at GitHub.com&quot;&gt;Robert Penner’s AS3 Signals&lt;/a&gt; have become a popular alternative to the AS3 event system. With the help of the &lt;a href=&quot;http://www.github.com/eidiot/as3-signals-utilities-async/&quot; title=&quot;AS3 Signals Utilities Async at GitHub.com&quot;&gt;Signal-Async wrapper library&lt;/a&gt;, asynchronous matchers do Signals too!&lt;/p&gt;

&lt;h4 id=&quot;asserting-on-signal-dispatchment&quot;&gt;Asserting on Signal dispatchment&lt;/h4&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dispatchesASignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;assertAsynchronouslyThat&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;signalDispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dispatchesSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

   &lt;span class=&quot;n&quot;&gt;signalDispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4 id=&quot;asserting-on-signal-arguments&quot;&gt;Asserting on Signal arguments&lt;/h4&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Test&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dispatchesASignalWithSpecificArguments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;():&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;assertAsynchronouslyThat&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;signalDispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dispatchesSignal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
      &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;which&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hasArguments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;123&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

   &lt;span class=&quot;n&quot;&gt;signalDispatcher&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;dispatch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;123&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id=&quot;the-code&quot;&gt;The code&lt;/h3&gt;
&lt;p&gt;Asynchronous matching is only an experiment I’ve been making use of in my own projects. If you’re interested in it, &lt;a href=&quot;http://github.com/pmowrer/hamcrest-as3-async/&quot; title=&quot;pmowrer&#39;s hamcrest-as3-async at GitHub.com&quot;&gt;please check it out on github&lt;/a&gt;. Please note that it depends on the most recent &lt;a href=&quot;http://www.github.com/drewbourne/hamcrest-as3&quot; title=&quot;drewbourne&#39;s hamcrest-as3 at Github.com&quot;&gt;hamcrest-as3 code&lt;/a&gt; and isn’t compatible with its most recent SWC release, 1.0.2.&lt;/p&gt;
</description>
        <pubDate>Thu, 19 Aug 2010 00:00:00 +0000</pubDate>
        <link>http://patrickmowrer.com/2010/08/19/improving-readability-of-asynchronous-tests-in-flexunit4-using-hamcrest-matchers/</link>
        <guid isPermaLink="true">http://patrickmowrer.com/2010/08/19/improving-readability-of-asynchronous-tests-in-flexunit4-using-hamcrest-matchers/</guid>
      </item>
    
      <item>
        <title>Part II: Using custom runners with Flash Builder 4&#39;s built-in FlexUnit4 support</title>
        <description>&lt;p&gt;Via asmock’s &lt;a href=&quot;http://sourceforge.net/apps/mediawiki/asmock/index.php?title=Installation&quot;&gt;installation wiki&lt;/a&gt;, I stumbled upon a second way to link a custom FlexUnit4 runner into a Flash Builder 4 project: using a compiler argument.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Add the following to the “Additional compiler arguments” under “Flex Compiler” in your project properties:&lt;br /&gt;
-includes asmock.integration.flexunit.ASMockClassRunner&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This way is probaby more straightforward than &lt;a href=&quot;/2010/03/09/using-custom-runners-flash-builder-4s-built-flexunit4-support/&quot;&gt;using a custom FlexUnitApplication&lt;/a&gt;, at least as long as you’re doing something simple.&lt;/p&gt;
</description>
        <pubDate>Tue, 30 Mar 2010 00:00:00 +0000</pubDate>
        <link>http://patrickmowrer.com/2010/03/30/part-ii-using-custom-runners-flash-builder-4s-built-flexunit4-support/</link>
        <guid isPermaLink="true">http://patrickmowrer.com/2010/03/30/part-ii-using-custom-runners-flash-builder-4s-built-flexunit4-support/</guid>
      </item>
    
      <item>
        <title>Using custom runners with Flash Builder 4&#39;s built-in FlexUnit4 support</title>
        <description>&lt;p&gt;Recently, I’ve been trying to get &lt;a href=&quot;http://bitbucket.org/loomis/mockito-flex/wiki/Home&quot;&gt;mockito-flex&lt;/a&gt; to play nice with Flash Builder 4’s built-in FlexUnit4 support. For its part, mockito requires the use of a custom test runner class, MockitoClassRunner, to run any test case containing mockito dependencies, declared using FlexUnit4’s “RunWith” metadata tag:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RunWith&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;org.mockito.integrations.flexunit4.MockitoClassRunner&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)]&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MockitoTestCase&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;One caveat of custom runners is that they require being linked into the project:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;RunWith(“fullyQualifiedName”)&lt;/strong&gt; &lt;br /&gt;
– Used to identify a specific runner that should be used for this class. Common uses include specifying a class to use the Suite runner or Theory runner. The class specified must be linked into the project and must implement the IRunner interface.&lt;/p&gt;

  &lt;p&gt;(from: &lt;a href=&quot;http://docs.flexunit.org/index.php?title=Metadata&quot;&gt;http://docs.flexunit.org/index.php?title=Metadata&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Without proper linkage FlexUnit4 will not be able to find the runner, throwing a runtime error such as the following:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Error: Custom runner class org.mockito.integrations.flexunit4.MockitoClassRunner should be linked into project and implement IRunner. Further it needs to have a constructor which either just accepts the class, or the class and a builder.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A simple way of linking the runner is to include a variable typed to the custom runner’s class inside of the class that initiates the test run. &lt;!--break--&gt;When using FB4’s built-in FlexUnit4 support, the class running the tests is FlexUnitApplication, auto-generated by FB4 after tests have been selected in the “Run FlexUnit Tests” dialog.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FlexUnitApplication&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Sprite&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mockitoRunner&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;MockitoClassRunner&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;FlexUnitApplication&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Though the auto-generation of FlexUnitApplication is very convenient feature, automating the otherwise tedious, manual labor of supplying test cases to the runner’s “run()” method, its re-generated from scratch each time the test case selection changes, discarding any custom alterations, including the linkage variable. Manually adding the variable each time FlexUnitApplication is regenerated is a tedious and error-prone process in itself, but one that can thankfully be avoided using the following technique.&lt;/p&gt;

&lt;p&gt;In FB4’s “Preferences” dialog, the one and only FlexUnit specific option lends itself very well to this situation. Here you can declare a custom application for FlexUnit4 to run instead of the one that’s auto-generated. Do note that using a custom application class does not stop the auto-generation of FlexUnitApplication, a fact that can be utilized to add a linkage variable that won’t get thrown away each time FlexUnitApplication is regenerated.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/flexunit_prefs.png&quot; alt=&quot;&quot; width=&quot;500&quot; height=&quot;268&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After a custom application name has been defined, the corresponding class needs to be created somewhere within the project hierarchy. This class should inherit from FlexUnitApplication and contain the linkage variable:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-as3&quot; data-lang=&quot;as3&quot;&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;org.mockito.integrations.flexunit4.MockitoClassRunner&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CustomFlexUnitApplication&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FlexUnitApplication&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; 
    &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mockitoRunner&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;MockitoClassRunner&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CustomFlexUnitApplication&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; 
    &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; 
        &lt;span class=&quot;kd&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Additionally, the custom application class needs to be made one of the runnable application files within the project (else FB4 will let you know so):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/customflexunitapp_runnable.png&quot; alt=&quot;&quot; width=&quot;500&quot; height=&quot;223&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now, when launching the “FlexUnit Tests” application via FB4, CustomFlexUnitApplication will be launched instead of FlexUnitApplication. As the former inherits from the latter, all of the auto-generated convenience is still available while keeping the linkage variable necessary to run the MockitoClassRunner.&lt;/p&gt;
</description>
        <pubDate>Tue, 09 Mar 2010 00:00:00 +0000</pubDate>
        <link>http://patrickmowrer.com/2010/03/09/using-custom-runners-flash-builder-4s-built-flexunit4-support/</link>
        <guid isPermaLink="true">http://patrickmowrer.com/2010/03/09/using-custom-runners-flash-builder-4s-built-flexunit4-support/</guid>
      </item>
    
      <item>
        <title>Compiling custom AS3 metadata in Flash Professional</title>
        <description>&lt;p&gt;The use of custom metadata tags is becoming more commonplace in frameworks and libraries developed for the Flash platform. While many are targeted specifically for use with Flex and, by extension, the mxmlc compiler, others have uses outside of Flex. An example is &lt;a href=&quot;http://docs.flexunit.org/index.php?title=Main_Page&quot; title=&quot;FlexUnit4&quot;&gt;FlexUnit4&lt;/a&gt;, which despite its name is easily used for testing AS3-only projects. Other testing frameworks that want to play nice with FlexUnit4, such as &lt;a href=&quot;http://code.google.com/p/mock-as3/&quot; title=&quot;mock-as3&quot;&gt;mock-as3&lt;/a&gt; and &lt;a href=&quot;http://bitbucket.org/loomis/mockito-flex/wiki/Home&quot; title=&quot;flex-mockito&quot;&gt;flex-mockito&lt;/a&gt;, have incorporated custom metadata as well.&lt;/p&gt;

&lt;p&gt;The mxmlc compiler accepts custom metadata with a command line option: &lt;em&gt;keep-as3-metadata&lt;/em&gt;. As of Flex Builder 3 (mxmlc 3.0), custom metadata can be integrated seamlessly, rendering the additional option unnecessary most of the time. However, if you aren’t using the mxmlc compiler to compile your AS3 project, you may find that you also aren’t able to use custom metadata. For example, if you attempt to compile a FlexUnit4 test case in Flash Professional, you encounter an unexpected error:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;initializationError Error: No runnable methods at org.flexunit.runners::BlockFlexUnit4ClassRunner/validateInstanceMethods()&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The Flash Pro compiler does support some metadata tags, like &lt;strong&gt;SWF&lt;/strong&gt; and &lt;strong&gt;Embed&lt;/strong&gt;, but not custom tags that FlexUnit4 relies on, such as &lt;strong&gt;Test&lt;/strong&gt;. &lt;!--break--&gt;As a result, all unrecognized tags are thrown out during compilation, in this example stripping the FlexUnit4 test case of any and all &lt;strong&gt;Test&lt;/strong&gt; tags. When FlexUnit4 then attempts to run the test case, it finds nothing to run, throwing the error above.&lt;/p&gt;

&lt;p&gt;As far as I know, Flash Pro doesn’t let you add command-line arguments to its compiler, but the good news is that there is a simple workaround to this problem, albeit a subtle one. By checking “&lt;strong&gt;Export SWC&lt;/strong&gt;” in the “Publish Settings” dialog, all custom metadata is left alone during compilation.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/export_swc.preview.png&quot; alt=&quot;&quot; height=&quot;104&quot; width=&quot;555&quot; /&gt;&lt;/p&gt;

</description>
        <pubDate>Wed, 03 Mar 2010 00:00:00 +0000</pubDate>
        <link>http://patrickmowrer.com/2010/03/03/compiling-custom-as3-metadata-flash-professional/</link>
        <guid isPermaLink="true">http://patrickmowrer.com/2010/03/03/compiling-custom-as3-metadata-flash-professional/</guid>
      </item>
    
  </channel>
</rss>
