My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
AntTasks  
Ant Tasks for use with the AIR Test Runner
Updated Feb 4, 2010 by legrosb@gmail.com

Introduction

The combination of the AIRTestRunner and the provided Ant Tasks are a powerful way to use Fluint with an automated build system. If you have not yet done so, be sure to synchronize the source for these projects.

The full source for both the AIRTestRunner and the ANT Tasks are available in the directory repository.

However, should you prefer, both of these items are also available as a JAR and AIR file respectively from the downloads page.

Requirements:

How to use the fluint Ant task : <fluint>

Place FluintAnt.jar in your system class path, or Ant /lib directory, so Ant can make it available. At runtime you can import it into the Ant script by using the <path> directive, if copied to a non-classpath folder:

<path id="libraries">
   <fileset dir="PATH_TO_DIR_WHERE_THE_FLUINT_JAR_WAS_COPIED">
      <include name="**/*.jar"/>
   </fileset>
</path>

Import and define the fluint Ant tag in your build script with the classname net.digitalprimates.ant.tasks.fluint.Fluint (the classpathref attribute is optional if the FluintAnt.jar file was already available on the classpath).

<taskdef name="fluint"
   classname="net.digitalprimates.ant.tasks.fluint.Fluint"
   classpathref="libraries" />

Now that the Ant task has been defined in your build file you can call it like so:

<fluint
   debug="true"
   headless="true"
   failonerror="false"
   workingDir="PATH_TO_LAUNCH_FLUINT_AIRTESTRUNNER_WITHIN"
   testRunner="PATH_TO_FLUINT_AIRTESTRUNNER_EXECUTABLE"
   outputDir="PATH_TO_REPORTING_DIR">

   <fileset dir="C:\temp\test">
      <include name="**/*.swf"/>
   </fileset>
</fluint>

The attributes of the <fluint> task are listed below:

  • debug="true|false" - Default: false. Return debug information to the console
  • headless="true|false" - Default: false. To run the AIR application in a headless (no UI) mode, or to launch and run the AIR application as a full application.

Note: this does not mean this can be launched from a truly headless server. Fluint will still instantiate visual objects, just not waste the time showing you a tree and progress bar. Further, the application will close immediately upon completion of the tests.

  • xvfb="true|false" - Default: false. Launches the executable provided in the testRunner property using the xvfb-run command available in X Windows under Linux for true headless execution of the AIR application. This property will only work when used in conjunction with headless="true". The resulting call is structured as below:
  • xvfb-run -a <path_to_test_runner> <arguments_to_test_runner>
  • failonerror="true|false" - Default: true. Causes the Ant build to fail if the Test Suite(s) executed contain failures or errors.
  • testRunner="" - The path to your installed copy of the fluint AIRTestRunner executable (i.e. - /Applications/FluintAIRTestRunner/Contents/MacOS/FluintAIRTestRunner or C:\Program Files\FluintAIRTestRunner\FluintAIRTestRunner.exe).
  • workingDir="" - Default: Ant script's basedir property. Directory from which the Fluint AIR runner should be executed and all relative paths for outputDir and fileset will be based.
  • outputDir="" - The location where the test runner should write the test results. A file named fluintResults.xml will be created by default that contains the results of the latest testing session.
  • fileset - A fileset of all .swf files to load for testing (compiled as mx:Modules implementing ITestSuiteModule).

Note: If you provide directories as opposed to files for the fileset option, the AIR testrunner will recurse those directories looking for .swf files to load as modules.

Sample Test Module

The following source shows a sample module which will run the framework test suite:

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" implements="net.digitalprimates.fluint.modules.ITestSuiteModule">
   <mx:Script>
   <![CDATA[
      import net.digitalprimates.fluint.unitTests.frameworkSuite.FrameworkSuite;
      
      public function getTestSuites() : Array 
      {
         var suiteArray : Array = new Array();
         suiteArray.push(new FrameworkSuite());
         return suiteArray;
      }
   ]]>
   </mx:Script>
</mx:Module>

The module must implement the net.digitalprimates.fluint.modules.ITestSuiteModule interface, which simply requires that it has a getTestSuites() method which returns an array of TestSuite instances.

A sample of this code can be found under tags/release-1.1.0 in the Source tab at samples/src/test/flex/AirTestModule.mxml.

Comment by van...@gmail.com, Oct 31, 2008

Hi,

I'm getting a following error when running ANT on Mac

path?/FluintAIRTestRunner.app: cannot execute

any ideas why?

thx, Jan

PS I had to recompile the task in JDK 1.5. The one provided doesn't seem to be compiled in correct version.

Comment by schul...@gmail.com, Nov 15, 2008

vanjan,

The test runner is a packaged app on Mac. So you need to set the path to something like this: /Applications/FluintAIRTestRunner.app/Contents/MacOS/FluintAIRTestRunner

Hope this helps,

Dan

Comment by robert.c...@gmail.com, Dec 17, 2008

A couple of questions:

I copied AIRTestRunner and tried replacing the harcoded directory in AIRTestRunner.mxml getFileSet() but that never gets called.

I then decided to run AIRTestRunner from inside eclipse and pass the -fileSet param. For example:

-fileSet=c:/searchcoders/workspace_flex/sample_project/bin-debug/modules

This almost works, but the fileSet argument parsing phase of the TestRunnerWindow? (around line 167, in "listenToCommandLine") gets the substring of my param and cuts off the first character. So the argument becomes: ":/searchcoders ...."

If I remove the test for "filesetString.length > 3" then it loads my arguments correctly.

Just curious about this and if it has anything to do with how it might be different if the argument is passed from an ant task.

Also, I would add to this wiki entry that if you create an AS test module it should also extend mx.modules.Module.

Thanks

/r

Comment by xinxing...@gmail.com, Dec 22, 2008

question:I followed the steps but it not work. "taskdef class net.digitalprimates.ant.tasks.fluint.Fluint cannot be found" and I don't know how to fix it. Thanks!

Comment by dewilh...@gmail.com, Jan 7, 2009

Hi

I've almost got this working .. the TestModule1?.swf from the downloads page works fine. However when I compile the example test module it hangs when running the tests.

Apparently the testrunner doesn't like myt modules. I'm using the SDK, and I specified -debug although that didn't seem to help either.

using Flex 3.2.0 on Mac osX 10.5

Any thoughts?

Dave

Comment by suprigya...@gmail.com, Jan 14, 2009

Hi,

I am trying to automate the tests into the build, but when I try the steps above, I get the error below. Could you please suggest, what I might be doing wrong? Also, would you have more elaborate documentation on how to automate this?

Thanks, Supri

java.lang.UnsupportedClassVersionError??: Bad version number in .class file

at java.lang.ClassLoader??.defineClass1(Native Method) at java.lang.ClassLoader??.defineClass(ClassLoader??.java:620) at org.apache.tools.ant.loader.AntClassLoader2??.defineClassFromData(AntClassLoader2??.java:76) at org.apache.tools.ant.AntClassLoader??.getClassFromStream(AntClassLoader??.java:1090) at org.apache.tools.ant.AntClassLoader??.findClassInComponents(AntClassLoader??.java:1154) at org.apache.tools.ant.AntClassLoader??.findClass(AntClassLoader??.java:1107) at org.apache.tools.ant.AntClassLoader??.loadClass(AntClassLoader??.java:977) at java.lang.ClassLoader??.loadClass(ClassLoader??.java:251) at java.lang.ClassLoader??.loadClassInternal(ClassLoader??.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:457) at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:183) at org.apache.tools.ant.UnknownElement??.execute(UnknownElement??.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.helper.ProjectHelper2??.parse(ProjectHelper2??.java:142) at org.apache.tools.ant.ProjectHelper??.configureProject(ProjectHelper??.java:91) at org.apache.tools.ant.Main.runBuild(Main.java:653) at org.apache.tools.ant.Main.startAnt(Main.java:187) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) Bad version number in .class file

Comment by slangeb...@gmail.com, Jan 14, 2009

I am having similar error, as well.

Using: Ant 1.7.1 Java 1.5.0 Flex SDK 3.2.0 FluintAnt15?.jar

Also - noticed that it is emanating from the taskdef: <taskdef name="fluint" ../>

As including it is now throwing the same error for other tasks:

BUILD FAILED java.lang.UnsupportedClassVersionError?: Bad version number in .class file

at java.lang.ClassLoader?.defineClass1(Native Method) at java.lang.ClassLoader?.defineClass(ClassLoader?.java:675) at org.apache.tools.ant.AntClassLoader?.defineClassFromData(AntClassLoader?.java:1146) at org.apache.tools.ant.AntClassLoader?.getClassFromStream(AntClassLoader?.java:1324) at org.apache.tools.ant.AntClassLoader?.findClassInComponents(AntClassLoader?.java:1388) at org.apache.tools.ant.AntClassLoader?.findClass(AntClassLoader?.java:1341) at org.apache.tools.ant.AntClassLoader?.loadClass(AntClassLoader?.java:1088) at java.lang.ClassLoader?.loadClass(ClassLoader?.java:251) at java.lang.ClassLoader?.loadClassInternal(ClassLoader?.java:374) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:583) at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:228) at org.apache.tools.ant.UnknownElement?.execute(UnknownElement?.java:288) at sun.reflect.NativeMethodAccessorImpl?.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl?.invoke(NativeMethodAccessorImpl?.java:39) at sun.reflect.DelegatingMethodAccessorImpl?.invoke(DelegatingMethodAccessorImpl?.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.tools.ant.dispatch.DispatchUtils?.execute(DispatchUtils?.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.helper.ProjectHelper2?.parse(ProjectHelper2?.java:142) at org.apache.tools.ant.ProjectHelper?.configureProject(ProjectHelper?.java:93) at org.apache.tools.ant.Main.runBuild(Main.java:743) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Comment by wes.ahr...@gmail.com, Jan 16, 2009

For the UnsupportedClassVersionError?, it's because they're compiled with Java 6.0 and you're probably using something older. I'm using Java 5 so I grabbed the source and compiled it with Java 5 and it seems to work fine.

Comment by mandeep...@gmail.com, Feb 3, 2009

I am getting the below error while executing the ANT task <test>

Error fluint? The ' characters around the executable and arguments are fluint? not part of the command.

Platform - Windows -XP

Kindly let me know , how to solve the problem.

Comment by dusty.je...@gmail.com, Feb 17, 2009

mandeepaks: that isn't an error, it's just echo'd to the console.

I'm having a similar problem as above.... my getTestSuites() function is never called. I thought this may be an issue with 3.1 vs 3.2 modules, but even after download and ensuring that I'm compiling with 3.2, the function is never called.

Suggestions?

Comment by guillaum...@gmail.com, Mar 18, 2009

Although headless="true" my FluintAIRTestRunner opens a window but never close it, I have to close it manually to terminate the ant task. Any idea ?

Comment by c.a.a...@gmail.com, Mar 20, 2009

One item of note, I had to change my "Module SWF size" to "Do not optimize (module can be loaded by multiple applications)" setting in FB3 to get this working.

Comment by glenn.go...@gmail.com, Apr 14, 2009

I am having the same problem as guillaume.mathias, where the test runner won't close. This is hanging my CI process.....any help?

Thanks!

Comment by nathanwa...@gmail.com, Jun 2, 2009

Where can I find FLUINTAirTestRunner.exe? I downloaded the Fluint_1.1.1.zip file from the downloads page, but I did not see FLUINTAirTestRunner.exe in it and I don't see it as a separate download on the download page. Thanks!

Comment by nathanwa...@gmail.com, Jun 4, 2009

I figured out the answer to my question about where to find FLUINTAirTestRunner.exe... fluint_1.1.1.zip includes a FluintAirTestRunner?_1.1.1.air file. This is an Adobe Air installation program that runs in the Adobe AIR application. So, you install Adobe AIR (Download the Adobe Integrated Runtime installation file from: www.adobe.com/go/learn_air_runtime_download) and then double click on the FluintAirTestRunner?_1.1.1.air file to install it, which creates a FluintAirTestRunner?.exe under c:\program files\FluintAirTestRunner? directory. The book Adobe AIR Bible, chapter 2 (Introduction to AIR/Setting Up Your Development Environment) on Safari Online books.


Sign in to add a comment
Powered by Google Project Hosting