Get Test Coverage Reports

The Maven Flexcover plugin is not quite finished, but for those that are impatient or adventurous, it is far enough along to do a few things. Until the plugin is finished and integrated into the normal build, there are 2 ways to run Flexcover with your flex-mojos project: Use the latest flexcover-mojo snapshot, or download your own Flexcover SDK and use a maven profile as a special build. I will show how to do each of them below.
[Read more →]

Automated UI tests

Some days ago, I came across with FlexMonkey.

FlexMonkey is a unit testing framework for Flex apps that provides for automating the testing of Flex UI functionality. FlexMonkey can record and play back Flex UI interactions, and generates ActionScript-based testing scripts that can easily be included within a continuous integration process. It uses the Flex Automation API and was created by adapting Adobe’s sample application, AutoQuick.

So I decide to try it with flex-mojos. And figure out it works, but, need some preparation.

With you wanna do that too, I first suggest you to take a look on FlexMokey quick tutorial here.

FlexMokey uses flex automation, so, we need to make it available at maven repository. So let’s start installing flexbuilder FDK at maven repo. For that task we use the install-mojo:
mvn info.flex-mojos:install-mojo:install-sdk -Dflex.sdk.folder=${your path to flexbuilder}/sdks/3.1.0 -Dversion=3.1.0-fb3

I call it 3.1.0-fb3. Because I don’t wanna to confuse with mpl version available at flex-mojos repo. I suggest you do the same.

Another dependency we need at maven repo is the flex monkey itselft. So, download this zip (or any newest), unpack somewhere and install it using maven install-file:
mvn install:install-file -DgroupId=com.gorillalogic -DartifactId=flexmonkey -Dversion=0.2b -Dpackaging=swc [-DgeneratePom=true] -Dfile=${unpack.folder}/MonkeyExample/libs/FlexMonkey.swc

I’m using this ids (groupId and artifactId) as personal guess. May be project authors can one day start to use maven and change it. So far they don’t. The parameter under [] is not required. But is good to have, avoid get maven trying to download this pom each time you compile the project.

Now we must create a pom.xml. Like this one:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
  <modelVersion>4.0.0</modelVersion>
 
  <groupId>info.flex-mojos.samples</groupId>
  <artifactId>flexmonkey-sample</artifactId>
  <version>1.0-SNAPSHOT</version>
 
  <packaging>swf</packaging>
 
  <build>
    <sourceDirectory>src</sourceDirectory><!-- I don't wanna change MonkeyExample project -->
    <resources>
      <resource>
        <directory>resources</directory><!-- need a resouces directory to FlexMonkeyEnv.xml -->
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>info.flex-mojos</groupId>
        <artifactId>flex-compiler-mojo</artifactId>
        <version>2.0M8-SNAPSHOT</version> <!-- need to use TRUNK -->
        <extensions>true</extensions>
        <configuration>
          <locales>
            <locale>en_US</locale>
          </locales>
          <includes>
            <include>test.FlexUnitTests</include>
          </includes>
        </configuration>
      </plugin>
      <plugin>
        <!-- get FlexMonkeyEnv.xml copyed -->
        <artifactId>maven-resources-plugin</artifactId>
        <configuration>
          <outputDirectory>${project.build.directory}</outputDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
 
  <repositories>
    <repository>
      <id>flex-mojos-repository</id>
      <url>http://svn.sonatype.org/flexmojos/repository/</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>flex-mojos-repository</id>
      <url>http://svn.sonatype.org/flexmojos/repository/</url>
    </pluginRepository>
  </pluginRepositories>
 
  <dependencies>
    <dependency>
      <groupId>com.adobe.flex.framework</groupId>
      <artifactId>flex-framework</artifactId>
      <version>3.1.0-fb3</version>
      <type>pom</type>
    </dependency>
    <dependency> <!-- I'm guessing this IDs -->
      <groupId>com.gorillalogic</groupId>
      <artifactId>flexmonkey</artifactId>
      <version>0.2b</version>
      <type>swc</type>
      <scope>internal</scope>
    </dependency>
 
    <!--
      Automation dependencies, already added by flex-framework, but need to
      change the scope
    -->
    <dependency>
      <groupId>com.adobe.flex.framework</groupId>
      <artifactId>automation</artifactId>
      <version>3.1.0-fb3</version>
      <type>swc</type>
      <scope>internal</scope>
    </dependency>
    <dependency>
      <groupId>com.adobe.flex.framework</groupId>
      <artifactId>automation_agent</artifactId>
      <version>3.1.0-fb3</version>
      <type>swc</type>
      <scope>internal</scope>
    </dependency>
 
    <!-- flexunit dependencies -->
    <dependency>
      <groupId>flexunit</groupId>
      <artifactId>flexunit</artifactId>
      <version>0.85</version>
      <type>swc</type>
      <scope>internal</scope>
    </dependency>
    <dependency>
      <groupId>flexunit.junit</groupId>
      <artifactId>flexunit-optional</artifactId>
      <version>0.85</version>
      <type>swc</type>
      <scope>test</scope>
    </dependency>
 
  </dependencies>
</project>

The last step is to copy FlexMonkeyEnv.xml from flexmonkey to resouces folder. That folder don’t exists, must be created.

Now you should be able to run maven:
mvn clean package [or install]

Double click on flexmonkey-sample-1.0-SNAPSHOT.swf should show Monkey Contact Manager with Flex Monkey panel. Like this.

So a fast check list.

    Install FLEX SDK using install-mojo
    Install FlexMonkey using maven install-file
    Create pom.xml
    Copy FlexMonkeyEnv.xml to resouces folder

My final project is available here.

So far so good, but, the application is not tested at maven build. How do we do that? I don’t know that! Yet. Anyone wanna help?

VELO

Flex-mojos 2.0M7

Another versions is out.

This time I fixed 10 issues. With some external help.

One relevant external help was made on generator mojo. Thanks to Tommy Odom patch, generator-mojo is now working with granite 1.1.0. Something that was complete out of my schedule. Issue 121.

Another change is relative to security sandbox. Before 2.0M7 was possible to add any test to Flash Player Security Sandbox. Was just necessary to change updateSecuritySandbox option to true. But only tests. Now, by default ALL SWF compiled with flex-mojos are add to Security Sandbox. If you don’t wanna you must define updateSecuritySandbox as false. Issue 111.

Some issues related to link reports and load external on tests are fixed too. Issues 117 and 119.

Another cool help from community was made on html-wrapper-mojo. Now is possible to define the output directory and the output name. Thanks to Luc. Issue 120.
html-wrapper-mojo had one more contribution from community. Lance Linder propose a solution to space usage on templates URI (commons-httpclient). That probably will prevent more issues related to URI in future. Issue 101.

Logan fixed 2 issues related to resource bundle. The first was on resource-bundle generation. When we introduce install-mojo, we install a new resource-bundle packing. The rb.swc beacon (This beacon is just a dummy file to make maven happy. But, at runtime we resolve the correct resource-bundle to the application location, so, an application in Japanese will require and use Japanese bundles). The second was related to resource-bundle usage on runtime localized applications. Compiler-mojo was just using all bundles at compilation of runtime bundles. Issues 109 and 112.

BTW, we (Logan and I, more Logan then myself) are planning a change on flex-mojos locales support. That will allow to compile a SWF with runtime and compiled locales. We still looking how to do that with low impact and how flex will react with that.

There is a few more, but I think this are the most relevant.

Enjoy.

VELO

Flex-mojos 2.0M6

Hi Folks,

Last weekend I released flex-mojos 2.0M6.

I fix just a few bugs issues 83, 103 and 105.

On this release I implement everything required to get backward compatibility working. Now I can start to update flex-mojos to use new things available only at flex 3.1 without breaking 3.0 or even 2.0 users.

BTW, 2.0 is doable now, but I didn’t take time to try it. So, if someone wanna try and post a how to, please, let me know.

VELO

Maven and Flex Builder tutorial

Today I came across with a interesting tutorial.

http://riadiscuss.jeffmaury.com/2008/09/maven-and-flex-builder-tutorial-part-i.html

I just the first part, and I don’t know how much are coming. But if you need help to start on maven flex world, take a look there.

VELO

Amazing new Maven archetype for Flex

Hi folks,

I found a very cool archetype this weekend, maven-blazeds-spring-archetype project.

But what is an archetype?

Archetype is a Maven project templating toolkit.

From Maven Introduction to Archetypes

I find this project awesome because it create one eclipse project with Java and Flex.

Great initiative, congratulations to project creator.

Just follow this instructions to get it working.

VELO

Backward Compatibility OR New Features OR Suggestions?

Hi folks…

Flex-mojos is reaching a crossroad.

Flex SDK 3.1 is out, and has some important bug fixes. Soon or latter FDK 3.2 will be out. FDK 3.3 too. FDK 4 is promissed to 2009 2nd Quarter.

This releases will bring some new features and that will break flex-mojos backward compatibility.

Now an important decision must be made:

    1 - Keep flex-mojos compatible with FDK 3.0.0.477 and don’t add new features.
    2 - Add new features and break compatibility with FDK 3.0.0.477.
    3 - Someone with came with some idea to make flex-mojos compatible with several versions of FDK.

I was think on check version and add ifs ifs ifs, but this will made the code impossible do maintain in future. So this idea is out.

Someone has experience on this kind of situations?
Can provide me any examples, ideas, design pattern, whatever?

VELO

Flex Maven Reports

Surfing over internet and googling a little bit I found a very interesting project:
Flex Maven Reports

About:
Flex Maven Reports includes various Maven reports for projects written with the Adobe Flex Framework. The current reports are the RemoteObject Maven Report, which show details about remote objects used in an application and generates a graphical view of them, and the Actionscript UML report, which shows UML diagrams of the classes.

You can check a report sample here and here (image).

You can check Maven Docs for project here.

That is it.

VELO

Flex-mojos 2.0M5, Maven 2 plugins for Flex

Hi folks…. another weekend release.

Last week one guys give me the suggestion to use milestone instead of alpha. So this release is 2.0 milestone 5.

This week I fix several minor issues (88, 89, 92, 93, 95, 97 and 99).

Enjoy.

VELO

Sample Projects… using maven and flex.

Time to time someone appears asking for samples…

Well, flex-mojos has several integration tests, and they can be used as samples. So, when you need any sample look here.

All mojos are covered on this tests and every feature is tested by integration tests, so it is very complete. Take a look.

http://svn.sonatype.org/flexmojos/trunk/rvin-mojo/test-harness/projects/

VELO