Metrics and the AIR Install Badge

Posted in FlexMonkey, Justin Shacklette on May 19th, 2010 by admin

The AIR Install Badge is a very handy little flash application for delivering AIR applications to your users via the web. The badge allows your users to download and install both your application and the Adobe AIR runtime. Additionally, the install badge will automatically prompt users to upgrade if a previously installed version is detected. At Gorilla Logic, we use the AIR Install Badge on the FlexMonkey download page (free registration required).

Alas, flash is opaque to analytics. We have no idea what our users are doing inside the AIR Install Badge application. Are they installing? Or upgrading? No problem, we just need to write some code…

The Code

Using flash’s ExternalInterface, we can manually push the data out of flash and into javascript. Once we have the data in javascript, we have total control. One option is to use google analytics to store our badge data. In the case of FlexMonkey, we send the badge data along with the user’s credentials to our CRM platform, SalesForce.com.

Step 1: First, open AIRInstallBadge.as and add this to the top:

import flash.external.ExternalInterface;

Step 2: Next, add the ExternalInterface call to the top of the handleActinClick() function in AIRInstallBadge.as:

protected function handleActionClick(evt:MouseEvent):void {
    if (action == 'install' || action == 'upgrade') {
        //send data to js
        ExternalInterface.call('badgeJS',action);
    }
    ...
}

Since I only care about the install or upgrade actions, I’ll only send those out to javascript. Re-compile the badge and deploy.

Step 3: Last, add the badgeJS() javascript callback to the page containing the badge and do whatever you want with the incoming badge data:

function badgeJS(action) {
    //do metrics here...
    alert('badge action=' + action);
}

Conclusion

With an hour of effort, and a very small amount of code, we’ve managed to get the useful metrics of installs and upgrades out of the AIR Install Badge and into our analytics engine of choice. A job well done.

Flex 4 Support Now Available From FlexMonkey / Gorilla Logic

Posted in FlexMonkey on May 11th, 2010 by jonr

Latest Version of Open-Source Testing Tool for Flex Applications Delivers Full Flex 4.0 Spark Component Support

Broomfield, CO – May 11th, 2010 – Gorilla Logic, an enterprise IT consulting services firm known for its top consulting talent, today announced the availability of FlexMonkeyTM 4.0 Beta 1. The new version provides support for the latest Flex 4 release from Adobe, including the entire Spark component set. With over 6,200 registered users, FlexMonkey has become the industry standard for automated record and playback testing of Adobe Flex interfaces used by companies around the world.

“The FlexMonkey 4.0 Beta 1 release delivers what our users have been asking for: support for Flex 4 including all Spark components. This lets FlexMonkey continue to answer to the Flex community’s need for quality assurance and unit testing for Flex applications,” said Eric Owens, FlexMonkey Guru, Gorilla Logic.

As a leading consulting services firm specializing in enterprise application development using Adobe Flex, HTML5, Java and mobile application development, Gorilla Logic developed FlexMonkey to deliver unparalleled quality to their Fortune 500 clients. In addition to providing a forum for the community of FlexMonkey users to assist each other (FlexMonkey Forum), Gorilla Logic also provides annual support contracts, implementation services and custom enhancement development for clients interested in optimizing their implementation of FlexMonkey.

“We use a continuous integration environment and are deploying FlexMonkey on the desktops of nearly 150 developers. For us, FlexMonkey is an option that cannot be ignored because it was obviously developed with one goal in mind – to facilitate the creation of high-quality Flex applications,” said Josse Brayelle, MAAF Assurances.

FlexMonkey is well suited for use by both developers and QA testers. It provides for regression and functional testing, and can be run from popular build systems and continuous integration environments, like CruiseControl. Gorilla Logic has assisted several companies in setting up their continuous integration environments and ensuring a production quality implementation of FlexMonkey.

In response to FlexMonkey’s value and ease-of use, Jokichi Oguri from HP commented, “The work you guys have done is incredible. May Gorillas rule the earth some day!”

FlexMonkey 4.0 Beta 1 is available today at www.gorillalogic.com/flexmonkey. Gorilla Logic also offers complete FlexMonkey training, implementation and off-shore testing services.

About Gorilla Logic

Gorilla Logic is an enterprise application development services and consulting firm known industry-wide for providing “gorilla” consultants that can dramatically improve development team productivity. Gorilla Logic has long demonstrated their industry-leading expertise in enterprise Java / JEE development, Adobe Flex / RIA development, and mobile device
application development, including the iPhone, Android and Blackberry. Gorilla Logic has been engaged to ensure the success of their most mission critical projects by Fortune 500 companies as well as small and medium-sized businesses and startups in industries ranging from financial services to entertainment to aerospace and the government sector.

Gorilla Logic also develops open source tools for Java, Flex, and iPhone developers.

For more information about Gorilla Logic, please visit www.gorillalogic.com or email info@gorillalogic.com.

Gorilla Logic Media Contact
Chad Sanderson
303.974.7088 ext. 7002
chad.sanderson@gorillalogic.com

Scraping Google Groups

Posted in FlexMonkey, Justin Shacklette on March 28th, 2010 by admin

When we launched the new and improved Gorilla Logic website, we decided to bring all our open source projects together under one roof. In order to migrate all things FlexMonkey back to our website, we need to get our forum data migrated out of Google Groups. Alas, Google doesn’t provide any way to export data from Google Groups. The only way to preserve the amazing contributions from the FlexMonkey community was to scrape Google Groups. So that’s just what we did.

With a very minimal amount of PHP, I was able to walk the entire FlexMonkey Google Group, scrap all the topics (aka threads) and all the posts inside each thread. The first step was to build a generic scraper class that grabs an html page (using cURL) and parses out all unique outbound links.

Here’s the code for the Scraper class:

class Scraper {
    private $url = '';
    public $html = '';
    public $links = array();
 
    public function __construct($url) {
        $this->url = $url;
    }
 
    public function run() {
        $this->html = '';
        $this->links = array();
 
        //scrape url & store html
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $this->html = curl_exec($ch);
        curl_close($ch);
 
         //parse html for all links
        $matches = array();
        preg_match_all('#<a.*?href\s*=\s*"(.*?)".*?>(.*?)</a>#i', $this->html, $matches);
 
        if ($matches !== false && count($matches) == 3) {
            for ($i = 0; $i < count($matches[1]); $i++) {
                $href = $matches[1][$i];
                $val = $matches[2][$i];
 
                //unique links
                if (!array_key_exists($href, $this->links)) {
                    $this->links[$href] = $val;
                }
            }
        }
    }
}

In the run() method, cURL is used to grab the html. Next, a regular expression is used to match all outbound links. The links are are stored in a hash, while making sure they point to unique urls.

Built on top of the generic Scraper class is a specialized Google Groups scraper class, aptly named GoogleGroupsScraper. For a given Google Group, the url of the main page (containing a list of most recent topics) is:

http://groups.google.com/group/[GROUP]/topics

And the url of a single topic (aka thread) is:

http://groups.google.com/group/[GROUP]/browse_thread/thread/[THEAD_ID]#

Where [GROUP] is the name of the Google Group, and [THREAD_ID] is some alphanumeric id. Most importantly, at the bottom of the main page is an Older » link that points to the next page of topics. The GoogleGroupsScraper exploits this to spider the entire group, recording topic title and topic url as it walks each page.

Next, each individual topic page is scraped by the GoogleGroupsTopicScraper class and parsed into a list of posts with author name, date, timestamp, etc. The topic scraper uses various regular expressions to extract and massage the html to extract the different parts of each post. In particular, the post body needs a lots of work to strip out any Google Groups specific links and code.

Lastly, the topics and their posts are assembled into an XML document with a nice big CDATA block around the post body to preserve the html content.

Here’s some sample output from the scraper:

<?xml version="1.0" encoding="UTF-8"?>
<scrape group="flexmonkey">
  <topic>
    <title>FlexMonkey User Group is now located at www.gorillalogic.com/flexmonkey!</title>
    <link>http://groups.google.com/group/flexmonkey/browse_thread/thread/fe9ed66bf56db88e#</link>
    <posts>
      <post idx="0">
        <author>Stu</author>
        <email>stu.st...@gorillalogic.com</email>
        <date>February 10, 2010 21:17:52 UTC</date>
        <timestamp>1265836672</timestamp>
        <body>
<![CDATA[
<p>People of FlexMonkey, <p>We have migrated the FlexMonkey discussion forum to <a href="http://www.gorillalogic.com/flexmonkey">http://www.gorillalogic.com/flexmonkey</a>. Please note that you will need to re-subscribe to the new forum to continue receiving FlexMonkey discussion messages. <p>-Stu <br>
]]>
        </body>
      </post>
    </posts>
  </topic>
  <topic>
    <title>Record button clicks based on Ids instead of names?</title>
    <link>http://groups.google.com/group/flexmonkey/browse_thread/thread/4f079b1959374f53#</link>
    <posts>
      <post idx="0">
        <author>Shilpa</author>
        <email>shilpa.g...@gmail.com</email>
        <date>February 9, 2010 23:44:44 UTC</date>
        <timestamp>1265759084</timestamp>
        <body>...</body>
      </post>
      <post idx="1">
        <author>Shilpa</author>
        <email>shilpa.g...@gmail.com</email>
        <date>February 10, 2010 00:05:44 UTC</date>
        <timestamp>1265760344</timestamp>
        <body>...</body>
      </post>
      <post idx="2">
        <author>Gokuldas K Pillai</author>
        <email>gokul...@gmail.com</email>
        <date>February 10, 2010 00:16:34 UTC</date>
        <timestamp>1265760994</timestamp>
        <body>...</body>
      </post>
      <post idx="3">
        <author>Shilpa</author>
        <email>shilpa.g...@gmail.com</email>
        <date>February 10, 2010 01:18:42 UTC</date>
        <timestamp>1265764722</timestamp>
        <body>...</body>
      </post>
...

Finally, there is a very simple PHP driver for the scraper that runs the scraping process:

require_once('GoogleGroupsScraper.class.php');
 
$scraper = new GoogleGroupsScraper('[GROUP]');
$scraper->run();
 
print $scraper->getXML();

And you run it as usual:

php scrape.php > output.xml

Just enter the name of the Google Group you wish to scrap, and away you go. Here are a couple of notes to help you along:

  1. [GROUP] is the group name as it appears in the url, so no spaces, etc.
  2. It’s not fast, so be patient, or modify the scraper code to generate some intermediate output.
  3. Via a browser, Google Group displays 30 topics per page, but via PHP & cURL you only get 10. Probably some Cookie or User Agent magic going on.
  4. Not much error handling. The error handling that exists isn’t very good. It will break.
  5. Good luck!

Please download the code and use it however you wish. Hopefully, putting the code online and writing this post will save someone else some time when migrating data off Google Groups.

Files

FlexMonkeyTM 1.0 GA Now Available From Gorilla Logic | Press Release

Posted in FlexMonkey on March 3rd, 2010 by jonr

Open-Source Functional Testing Tool for Adobe Flex Applications – New and Improved!

Broomfield, CO – March 3rd, 2010 – Gorilla Logic, an enterprise IT consulting services firm known for its top consulting talent, today announced the availability of FlexMonkeyTM 1.0 GA. With a rapidly growing user base that recently surpassed 5,000 registered users, FlexMonkey is a de facto standard for automated functional testing of Flex applications. After eight months of maturing in a beta status, FlexMonkey is now available for production use by developers and quality assurance professionals everywhere.

“FlexMonkey has been invaluable for us in testing Adobe Air applications. It has found bugs and regressions on several occasions, preventing them from ever reaching customers. And…I had everything I needed to add FlexMonkey tests into our continuous integration environment,” said Michael Portuesi, Principal Engineer, Zoodles.com.

FlexMonkey is an open source testing tool providing record/playback functional testing of
Adobe Flex applications. FlexMonkey 1.0 GA delivers the features and improvements most
requested by the FlexMonkey user community including:

  • “Wait For” handling – removes reliance on the PauseCommand by defining conditions that pause a script until true
  • Fuzzy Bitmap Compare – the Verify command for bitmap images now allows for user controlled tolerances in color comparisons
  • Simplified Setup – new easier process for configuring FlexMonkey testing of an application
  • Compatibility – out of the box compatibility with multiple Flex SDKs (3.3, 3.4.1 and
    3.5)
  • Code Compiling – easier customization and compilation of FlexMonkey source

“FlexMonkey keeps me from becoming exactly that – a monkey chained to a desk manually testing our software,” said Max Cameron, Co-Founder, Big Bang Technology, Inc. “Simply put, FlexMonkey kicks ass. It softens the enormous overhead of functional testing, and more importantly, it let’s my engineers get some sleep at night.”

FlexMonkey is well-suited for use by both developers and QA testers. It provides for regression and functional testing, and can be run from popular build systems and continuous integration environments, like CruiseControl.

“FlexMonkey 1.0 GA marks a major milestone for the FlexMonkey open source project and the Flex community who have come to rely on it. We encourage all existing users to upgrade to this new version which paves the way for our upcoming FlexMonkey releases for Flex 4, as well as our FlexMonkey/Selenium bridge,” said Stu Stern, CEO, Gorilla Logic.

FlexMonkey 1.0 GA is available today at www.gorillalogic.com/flexmonkey. Gorilla Logic also offers complete FlexMonkey training and testing services. Customers interested in early access to FlexMonkey for the Flex 4 SDK and the FlexMonkey/Selenium bridge should contact Gorilla Logic at www.gorillalogic.com/who-we-are/contact.

About Gorilla Logic

Gorilla Logic is an enterprise application development services and consulting firm known industry-wide for providing “gorilla” consultants that can dramatically improve development team productivity. Gorilla Logic has long demonstrated their industry-leading expertise in enterprise Java / JEE development, Adobe Flex / RIA development, and mobile device application development, including the iPhone. Gorilla Logic has been engaged to ensure the success of their most mission critical projects by Fortune 500 companies as well as small and mediums-zed businesses and startups in industries ranging from financial services to entertainment to aerospace and the government sector.

Gorilla Logic also develops open source tools for Java, Flex, and iPhone developers.
FoneMonkey (www.gorillalogic.com/fonemonkey)
FlexMonkey (www.gorillalogic.com/flexmonkey)
MonkeyWrench (www.gorillalogic.com/monkeywrench)
OpenGXE (www.gorillalogic.com/opengxe)

For more information about Gorilla Logic, please visit www.gorillalogic.com or email info@gorillalogic.com.

###

Gorilla Logic Media Contact
Chad Sanderson
303.974.7088 ext. 7002
chad.sanderson@gorillalogic.com

Why FlexMonkey is Game Changing for Flex Developers

Posted in FlexMonkey on December 9th, 2009 by jonr

What is FlexMonkey?

FlexMonkey is an open source Adobe AIR application used for testing Flex and AIR applications. It provides the functionality to record, playback, and verify Flex UI interactions. It also generates ActionScript / fluint tests that you can easily include within a continuous integration environment.

Who is FlexMonkey for?

Like many in the Flex community, we came to Flex development after many years of developing traditional web applications, where there are multiple tools that allow a developer to simulate a UI client for testing (like HTMLUnit). For testing our Flex user interfaces, we had a strong desire to continue using this paradigm for our developer level testing.

As software consultants, ensuring quality is an important part of what we do. So, we created FlexMonkey to fill the gap between a unit test and what’s really needed to ensure quality (and protect against regression) when developing user interfaces. While we initially created FlexMonkey for developers, many in the FlexMonkey community have found it just as valuable for use in creating QA / Functional tests.

So, we believe that FlexMonkey is useful to both software developers and quality control engineers on Flex development projects.

So, what’s so game changing about it?

If you ask Mike Labriola (one of the Fluint/FlexUnit 4 guys), ‘How do I unit test my Flex user interfaces?’ He will quickly respond, ‘You don’t.’ He won’t tell you this because he doesn’t believe in unit testing (as I can assure you that he strongly believes in Unit Testing), but because there are parts of a user interface that cannot be sufficiently tested with unit tests.

So, as we jump into the reasons why FlexMonkey matters for you, I’ll note that we do not believe that FlexMonkey replaces the need for traditional unit tests. There are still parts of a Flex application that are best tested this way (e.g. service clients, business logic, etc.). If you are building a framework, it’s likely that the majority of your testing will be done through unit tests, but if you are focusing on features and functionality you will likely be able to achieve upwards of 80% of your testing goals with FlexMonkey. Nevertheless, here are the high level places where FlexMonkey changes the game:

  1. FlexMonkey fills the gap left between unit testing and a truly successful test suite, as it provides a tool for doing developer level functional tests that replace traditional unit testing activities that developers perform in other tiers of application development.
  2. FlexMonkey allows developers to write their user interface code in the most natural way. Typically, when developing a user interface application without a tool to simulate a client of the running application, the code has to be written differently to support testing. This often leads to many unnatural acts, which can be avoided when using FlexMonkey.

    For the Java folks, I like to bring up the SpringFramework here, as it provides us with a powerful example of a framework that largely succeeded because it allows developers to write their code in a natural way. Over the long run, the frameworks and tools that make it possible for developers to work in the most natural way will always win out.

    Tools like FlexMonkey are able to facilitate this simply through the paradigm they provide for testing user interfaces, as they allow developers to test applications without any knowledge of the underlying code.

  3. Cost. FlexMonkey is free. So, even though it’s not a perfect tool, it does enable one to build and deploy a successful test suite, a task that is extremely difficult and costly in Flex development without FlexMonkey.

You can find the FlexMonkey project at: http://flexmonkey.gorillalogic.com/

FlexMonkey is built and open-sourced by Gorilla Logic, Inc.

Why FlexMonkey is Game Changing for Flex Developers

Posted in FlexMonkey, Jon Rose on December 6th, 2009 by jonr

What is FlexMonkey?

FlexMonkey is an open source Adobe AIR application used for testing Flex and AIR applications.  It provides the functionality to record, playback, and verify Flex UI interactions.  It also generates ActionScript / fluint tests that you can easily include within a continuous integration environment.

Who is FlexMonkey for?

Like many in the Flex community, we came to Flex development after many years of developing traditional web applications, where there are multiple tools that allow a developer to simulate a UI client for testing (like HTMLUnit).  For testing our Flex user interfaces, we had a strong desire to continue using this paradigm for our developer level testing.

As software consultants, ensuring quality is an important part of what we do.  So, we created FlexMonkey to fill the gap between a unit test and what’s really needed to ensure quality (and protect against regression) when developing user interfaces.  While we initially created FlexMonkey for developers, many in the FlexMonkey community have found it just as valuable for use in creating QA / Functional tests.

So, we believe that FlexMonkey is useful to both software developers and quality control engineers on Flex development projects.

So, what’s so game changing about it?

If you ask Mike Labriola (one of the Fluint/FlexUnit 4 guys), ‘How do I unit test my Flex user interfaces?’  He will quickly respond, ‘You don’t.’  He won’t tell you this because he doesn’t believe in unit testing (as I can assure you that he strongly believes in Unit Testing), but because there are parts of a user interface that cannot be sufficiently tested with unit tests.

So, as we jump into the reasons why FlexMonkey matters for you, I’ll note that we do not believe that FlexMonkey replaces the need for traditional unit tests.  There are still parts of a Flex application that are best tested this way (e.g. service clients, business logic, etc.).  If you are building a framework, it’s likely that the majority of your testing will be done through unit tests, but if you are focusing on features and functionality you will likely be able to achieve upwards of 80% of your testing goals with FlexMonkey.  Nevertheless, here are the high level places where FlexMonkey changes the game:

  1. FlexMonkey fills the gap left between unit testing and a truly successful test suite,  as it provides a tool for doing developer level functional tests that replace traditional unit testing activities that developers perform in other tiers of application development.
  2. FlexMonkey allows developers to write their user interface code in the most natural way. Typically, when developing a user interface application without a tool to simulate a client of the running application, the code has to be written differently to support testing.  This often leads to many unnatural acts, which can be avoided when using FlexMonkey.

    For the Java folks, I like to bring up the SpringFramework here, as it provides us with a powerful example of a framework that largely succeeded because it allows developers to write their code in a natural way.  Over the long run, the frameworks and tools that make it possible for developers to work in the most natural way will always win out.

    Tools like FlexMonkey are able to facilitate this simply through the paradigm they provide for testing user interfaces, as they allow developers to test applications without any knowledge of the underlying code.

  3. Cost. FlexMonkey is free.  So, even though it’s not a perfect tool, it does enable one to build and deploy a successful test suite, a task that is extremely difficult and costly in Flex development without FlexMonkey.

You can find the FlexMonkey project at: http://flexmonkey.gorillalogic.com/

FlexMonkey is built and open-sourced by Gorilla Logic, Inc.

FlexMonkey 1.0 Beta 2 and the FlexMonkey User Guide are here!

Posted in FlexMonkey on August 18th, 2009 by admin

Announcing the immediate availability of FlexMonkey 1.0 Beta 2! After the very successful Beta 1 launch last month, we are pleased to bring you Beta 2. Since Beta 1 had very frew issues, Beta 2 is much more of an enhancement than a bug-fix release.

Most notably, Beta 2 introduces “MonkeyLink”, which allows you to link FlexMonkey directly into your target SWF. If you have had any problems dynamically loading your application through the FlexMonkey Console or the MonkeyAgent, you can now instead compile MonkeyLink into your application SWF, and then launch your application directly. Using MonkeyLink, you can test virtually any Flex or AIR application. Dynamic SWF loading with the Console or the MonkeyAgent are of course still supported so you also continue to have the option of testing SWFs without having to first recompile them.

Download FlexMonkey 1.0 Beta 2 now at http://flexmonkey.gorillalogic.com/gl/stuff.flexmonkey.download.html!

The long-awaited FlexMonkey User Guide is available at http://flexmonkey.gorillalogic.com/gl/stuff.flexmonkey.documentation.html! Weighing in at nearly 60 pages, the FlexMonkey User Guide is like having your very own Eric Owens!

Happy testing!

FlexMonkey on DrunkOnSoftware.com

Posted in FlexMonkey on July 20th, 2009 by jonr

In another exciting installment of Jon Rose and James Ward’s Drunk On Software, they chat with FlexMonkey project founder Stu Stern in celebration of the first production release of FlexMonkey. The  conversation may lack a bit of focus, but does have some good info if you stick with it.

FlexMonkey Resources:

You can find the original post here: http://www.drunkonsoftware.com/2009/07/14/episode-14-flexmonkey/

Episode 14: FlexMonkey Fiesta at Casa Bonita

Posted in Drunk On Software, FlexMonkey, Jon Rose on July 20th, 2009 by jonr

In another exciting installment of Drunk On Software, we chat with Gorilla Logic’s Stu Stern in celebration of the first production release of FlexMonkey. Our conversation may lack a bit of focus, but does have some good info if you stick with us. We hope you enjoy watching as much as we enjoyed filming it.

FlexMonkey Resources:

You can find the original post here: http://www.drunkonsoftware.com/2009/07/14/episode-14-flexmonkey/

FlexMonkey brings unit testing to Flex user interface developers

Posted in FlexMonkey on July 19th, 2009 by jonr

In Stu Stern’s recent InfoQ.com article on UI testing and FlexMonkey, he explains the code-a-little-test-a-little (CALTAL) approach to test driven development with user interface development and walks you through using FlexMonkey to support the theory.

The practice of maintaining automated unit test suites has gained widespread acceptance over the past decade to the point where most developers today either engage in some amount of test writing or at least feel bad for not doing it. This rise in automated unit testing has led to some confusion about who should be testing what. Should developers strive for 100% code coverage with their unit tests, and if so, does that mean we no longer need dedicated QA testers? Many development teams draw the line at the user interface, reasoning that since user interfaces can be exercised with little or no programming they can be tested more economically by dedicated testers, either manually or with specialized testing tools. This division of labor has led many to divide the world of testing into “unit testing” and “functional testing”, with developers providing the former and QA testers providing the latter. In this article we’ll explore how Gorilla Logic’s new, open source Flex user interface automation testing tool, FlexMonkey, can enhance the productivity of both developers and QA testers. FlexMonkey allows developers to incorporate user interface testing into unit test suites and continuous integration environments, and allows QA testers to expand those unit tests to create and maintain comprehensive quality tests.

Enjoy the full article at: http://www.infoq.com/articles/flexmonkey-ui-unit-testing