What are some Open Source UI Testing Tools in Flex?

This question comes in from "P" and I'm kind of stuck to give him an answer.

I need to implement TDD in our flex application and condition is that we need to use a open source. My application is primarily has drag and drop functionality. I tried and analyzed several Test automation tools such as FlexMonkey, webdriver etc. they work fine till some extent.But they fail to recognize drag and drop actions and customcomponents.

Basic problem is that all Automated Testing tools identifies 'id' to perform any action. And in case of drag and drop all ids are generated on runtime Can you please suggest me any tool which can help or any change in my code which can help.

I'm at a bit of a loss. Obviously from P's question he needs a UI Testing tool; and FlexMonkey is the most well known in the Flex world. But, it wouldn't work for him.

I said that to get FlexMonkey to work with custom components, he may need to create a custom automation delegate and recompile Flex Monkey. But, I could never get that to work myself and eventually had to put it aside to focus on other things.

So, dear readers, what would you suggest? Are there other options out there?


I do like fielding questions from the audience, and have been doing a lot of that over on Stack Overflow and the Flextras Friday Lunch Podcast.

If you have questions feel free to ask me privately or stop by a Flextras Friday Lunch session.

You can get personal, confidential help from me [with screen sharing] via www.AskTheFlexpert.com.

You can also fine me at 360|Flex in DC this September.

360|Flex comes to Washington DC in September

In my 8th grade year book we had the opportunity to write biographies for each other. Most of them were slightly humorous; and many had us dying in weird and bizarre ways. What happened to me?

After replacing much of my body parts with computer hardware, I electrocuted myself during a failed world takeover by falling into the reflection pool between the Washington Monument and Lincoln Memorial.

I don't want to give away any spoilers, but I strongly recommend you make a trip to 360|Flex DC this September to welcome in my new world order. There will be Zombies involved. Thank you Brian Nolan.

360|Flex, if you didn't know, is my favorite Flex conference, and it will land in DC on September 19th.

You can register here or try to respond to their call for papers and get yourself a presentation spot.

Note: Image stole from http://www.visitingdc.com/memorial/washington-monument-address.htm

How do I convert a URLpath to SysFilePath if I have the file's URL?

I'm in a writing mood, so decided to tackle this question:

One of your pages talks about how to get a/the filepath from a URL path; so if I know the URL where a file is, can I obtain the (absolute) path, on the server, where this file is? I will gladly supply more details, I just now would like to know if this is doable, in general. thanx!!

This is a hard question to address. First, I don't intimately remember all my 560 blog posts, and the user did not let me know which one he was referring to. Second, I am not aware which technology the user is referring to. Does he want an answer for Flex? Or AIR? Or ColdFusion?

I decided to tackle answers in all three technologies. Assuming you have a URL, how do you get the system path to the file?

In CF, I believe expandPath should give you the absolute file path. Just strip out the domain name of the URL before calling it. In Flex I do not believe you can access the file path of the server, nor the client. The security sandbox prevents such access.

In AIR, a URL to a local file is also the absolute path; but you wouldn't have access to the absolute path on the server.

So, in summary, for ColdFusion use the expandPath function. In Flex or AIR, you need a convoluted work around, such as a server side service or a desktop server piece like Merapi.

You can always ask me your question here, or stop by a Flextras Friday Lunch session and ask me in person.

Air on Netbooks

This question comes in from Tomas about running AIR on Netbooks.


I wanted to know if you personally or through a third-party had experience of Adobe Air running on a netbook. I don't have one of those close to me and wanted to know if it was worth it. At least the resolution is good enough for my app.

Can anyone answer Tomas's question?

I have not had any experience w/ AIR on Netbooks. Although, I know of no reason why it wouldn't work, assuming you have a supported operating system. I suppose there could be potential performance issues.

I love answering questions from readers or podcast listeners, so feel free to send them in.

Lately my writing energies have been pulled between the Flextras Friday Lunch and The Flex Show podcast. If you have questions and want to nail me on them live, drop by the Flextras Friday Lunch. Every Friday at 1pm EST.

How do I uninstall AIR Applications Programatically?

This questions comes in from Krunal and he asks about installing / uninstalling an AIR application from another program.

Can I install / uninstall the air application programatically? Suppose i have a X air application and application have a facility to install / uninstall the Y (air application). Is it possible?

If I understand Krunal correctly, he has an AIR application that he installs as part of another larger installer. When he creates an uninstall routine for the larger program, he wants to uninstall the AIR application too.

To do this "Formally" I think you need to sign up for Adobe's the Runtime Distribution program for AIR. I believe once you're in they'll give you access / information on how to do that.

I believe that the program gives you access to install AIR applications and the AIR runtime in invisible mode, but I could be wrong about that.

All that said, I haven't looked specifically into how AIR applications are uninstalled. I suspect that there is just an executable that you can launch from your custom uninstaller.

If Krunal wants to bundle two different AIR applications together using the default AIR installer / uninstaller, I'm unsure how that would work.

That said, I'm hard at work on the Flextras AutocompleteComboBox and have been blogging less. There is now also a Flextras Blog and I have been holding weekly live Q&A / Demo meetings, every Friday at 1pm EST.

I love answering questions, so if you have one, feel free to Ask away! Or stop by one of the Flextras Friday Lunch demos and stump me in real time.

How do I access a database directly from Flex?

This question came from a reader with no name.


I want to use the remote connection in adobe air (Action Script) to connect the database ( oracle, SQL Server etc...)

My short is answer is that you can't do this.

For a longer answer, Most people use some form of middleware; such as ColdFusion, Java, PHP, Ruby, etc... .

So, build a service in your language of choice to access the database; then use RemoteObject from your AIR app to access those services. I'm not sure if AIR will have crossdomain.xml issues or not.

There was an open source project around at one point which used sockets in the Flash player to run SQL directly against a database. I never got the impression it was production ready, though. And I can't find it in Google right now.

I love the questions that are easy to answer. Do you have one to ask me?

How do I make an AIR Window be always on top?

This question comes in from Martijn:


hi, thanks for posting that stuff about minimizing the adobe air window :) I wondered if you also know if air supports the native window to be "always on top" on your desktop. I can't find anything about the subject. Thanks, Martijn

I've done some experiments with this in the past, but couldn't find my old code. The WindowsApplication tag has an alwaysInFront property.

To make an app always stay on top, just do this:


<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" alwaysInFront="true">
</mx:WindowedApplication>

In my experiments, I was testing out AIR to run in Kiosk mode application, so I was also using alwaysInFront with a full screen. You can make things full screen by doing this:


<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" alwaysInFront="true"
applicationComplete="onApplicationComplete()">

<mx:Script><![CDATA[
            
public function onApplicationComplete():void{
this.stage.displayState = StageDisplayState.FULL_SCREEN;
}
]]>
</mx:Script>
</mx:WindowedApplication>

Using the ApplicationComplete event, I trigger a function to run this in "large" mode. It just sets the displayState of the stage into Full Screen. You cannot run this code on CreationComplete because the Application stage object is not initialized before the ApplicationComplete event is triggered.

Did I mention I love answering questions? You should feel free to ask away.

Will Adobe Open Screen Project bring Flash to Game Consoles?

Will the Adobe Open Screen Project bring the Flash player to game consoles? Will I be able to create a Flash game and deploy it via Wiiware?

The open screen project removes some licensing restrictions on delivering the Flash Player and also documents a porting layer for the API, making it easier to get the Flash Player working on your device. I do not see Nintendo or Sony or Microsoft on the list of supporters, but I do think this move would make it easier to implement a version of the Flash Player for game consoles. I wonder if a game developer would take the time to do that, or if it has to be done by the console maker?

The implications for a game developer to be able to develop something once and deploy it across consoles and computers consistently is huge. Maybe my next company will be a gaming company. I'm still digesting what this will mean for the community as Flash and Flex Developers.

Ryan's post on the topic also mentioned also mentioned Adobe AIR for devices, which is a new concept for me. Kevin Lynch's video also mentions AIR for Devices.

Using AIR to launch other applications

Lets say you want to open an MS Word file from your web page. You can just link to it using a normal HREF. Browser settings and the operating system will take care of the rest. If it's a PDF, Reader will open. Word will launch for a .doc file. Excel for an excel sheet. ( Or perhaps your browser independent equivalents ).

How do you give the same functionality to an AIR Application? This exact question came up on the Flex Coders list recently and the general concensus was that it could not be done. That surprised me, because I figured you could do something very similiar to what you would do in a web page and let the operating system handle it. This would (I assume) not violate ay security protocols inside AIR. Am I right?

I played around with it and found one solution to the problem. It's far from perfect, though. I accomplished this using the NavigateToURL functionality. The code is really simple, just a button to open the file:


<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script><![CDATA[
import flash.net.URLRequest;
        
public function clickButton():void{
var request : URLRequest = new URLRequest('C:\\projects\\test.doc');
navigateToURL(request )    
}
]]>
</mx:Script>
    
<mx:Button click="clickButton()" />
</mx:WindowedApplication>

Click the button, it creates a URL Request and then uses navigateToURL to launch it. In my tests, this will launch a browser instance outside of AIR; and that browser instance will deal with the file, launching word, or a text editor, or whatever depending upon the file.

I can understand how, in some situations this would not be ideal. Perhaps in AIR next we need a navigateToApplication?

How can I find the user's screen size in AIR?

Yesterday, someone posted to Apollo Coders to ask if they can find out the user's screen resolution in an AIR application. The answer is yes, you can.

You can find this information out using the flash.system.Capabilities class. You need to look at the screenResolutionX and screenResolutionY properties. These are static properties on the Capabilities class, so you do not need to create an instance.

The poster also asked if he could find the height and width of the current window. This on was even easier to answer, because windows (and most UI controls ) have a height and width in the Flex framework.

I can demonstrate both of these answers with a single code sample. This code sample will size the application window to 60% of the screen width:


<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
     preinitialize="preInitializeHandler()"/>

<mx:Script><![CDATA[

import flash.system.Capabilities;
import mx.controls.Alert

private function preInitializeHandler():void{
// set the width to 60% of the full screen
this.height = Capabilities.screenResolutionY * .6;
this.width = Capabilities.screenResolutionX * .6;
this.visible = true;
}

]]>
</mx:Script>

</mx:WindowedApplication>

This code is very similar to something I used in a Flex application for a client. It runs code in the preinitialize event. That code sets the height and width of the WindowedApplication to 60% of the screenResolution. Then it makes the window visible. ( I set the window to be invisible in the app.xml file )

As a note, this should work in a Flex app too, but I haven't tried it.

I got a busy week this week. Thursday I'm at a a Microsoft even in Hartford. I understand they are giving out free software. Friday I'm down in NYC to do some podcast interviews at Flex Camp Wall Street.

More Entries

All Content Copyright 2005, 2006, 2007, 2008, 2009 Jeffry Houser. May not be reused without permission
BlogCFC was created by Raymond Camden. This blog is running version 5.9.2.002.