Saturday, November 17, 2007

FunFX - The background

FunFX is a framework for funcional testing of Adobe Flex applications. This post will talk about the background for this tool and some on the implementation decisions.

According to Wikipedia, Adobe Flex is a collection of technologies released by Adobe Systems for the development and deployment of cross platform, rich Internet applications based on the proprietary Adobe Flash platform.

FunFX was initiated by Bekk Consulting in desember 2006 as a master thesis at the Norwegian University of Science and Technology. This was due to Flex's lack of a proper tool for automated functional testing. The only tool was Mercury's Quick Test Professional, which does not support TDD and cost a whole lot of money. We wanted to create an open source version that would support TDD.

I began the work on this framework January 2007, and did not have a lot of experience with Flex. I decided to use Ruby as the language for the actual framework for writing the test scripts.

The first initial problem and the most critical part of this framework was how to be able to talk to the Flex application and make it replay certain events. After some starting tips from Matt Chotin, Sreenivas Ramaswamy, and Matt Horn from Adobe, I decided to use the ExternalInterface API. This enabled me to expose certain "generic" methods out, enabling Ruby scripts to make calls into the Flex application.

I built a Flex library file that acts as an adapter between a Flex application and the Ruby tests. The Ruby framework is dynamically built from an XML file delivered by Adobe that describes all the different display objecs and their events and properties. This makes it possible to write test lines as the following:

@ie.button("name").click
@ie.button("name").label

When running the Ruby script the adapter will try to find a display object by the type button with the name "name" and run either the click event or delivering the lebel text of the button.

The Ruby framework uses the WIN32OLE to drive an Internet Explorer window and the Flex application displayed.

There are currently no support for other browsers or to test a Flex application in the Flash player.

The next post will help getting started with FunFX.

24 comments:

Ziki said...

Hi, i just tried to setup FunFX on flex 2.0.1 and got very strange error "unable to load SWC FunFXAdapter.swc" i wondered if someone familiar with this issue or it is a local problem.
thanks!

Ziki said...

another thing, :)
after creating the swc from source by my self and tried to run the example i got the following error (any advice?) :
ruby work_group_test.rb
Loaded suite work_group_test
Started
E
Finished in 8.984 seconds.

1) Error:
test_work_group(WorkGroupTest):
WIN32OLERuntimeError: unknown property or method `isSynchronized'
HRESULT error code:0x80020006
Unknown name.
d:/ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.2/lib/flex.rb:105:in `method_missing'
d:/ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.2/lib/flex.rb:105:in `is_sync'
d:/ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.2/lib/flex.rb:27:in `method_missing'
work_group_test.rb:29:in `test_work_group'

1 tests, 0 assertions, 0 failures, 1 errors

Peter Motzfeldt said...

Hi Ziki

The unable to load SWC error is due to difference in SDK's I think. So it should work when you build your own.

With the other error, it seems like it does not have the automation xml file. Check that the AutomationGenericEnv.xml file is located in you output (bin) folder in your Flex app.

Lt me know if it was that or not.

Ziki said...

Thanks for the response !!
yes, you are right for the first, compiling with my sdk solved the problem,
about the second one, there is another swc file named "automation_agent_rb.swc" that should be included in order to compile and run the project. May be you should mention that in your tutor.

Peter Motzfeldt said...

Thanks Ziki, I will add the info about the automation_agent_rb.swc file.

His Dudeness said...

Hi Peter, I have FunFx working OK but I'm trying to type some text in an TextInput field and press the enter key to send the message.
How do I do this with FunFx and ruby?

I currently have this line of code.

@ie.text_area("textMessage").input(:item_renderer => "hello", :enter_key => true)

Thanks.

Peter Motzfeldt said...

Hi

Oh, using the keyboard have I not been thinking of. Hmm, I am not sure if this is supported.

Ankur said...

hi,i m facing the same error...
1) Error:
test_Shar_On(SharOnTest):
WIN32OLERuntimeError: unknown property or method `isSynchronized'
HRESULT error code:0x80020006
Unknown name.
C:/Program Files/Ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:106:in `method_missing'
C:/Program Files/Ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:106:in `is_sync'
C:/Program Files/Ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:28:in `method_missing'



I have tried everything but didn't solve....

Peter Motzfeldt said...

Hi Ankur, sorry about the late response. It seems that the FunFXAdapter.swc file is not included in your Flex application.

Does your swf get bigger when you add FunFXAdapter.swc?

Ankur said...

Thanks Peter..Now it is working...

Ankur said...

Hi peter,
I m using accordion.
@ie.accordion("accordion").change(:related_object => "Blue")is working but i want to access it through index because i m unable to access related boject because accordion is made dynamically.
so tell me the solution so that i can access accordion through index....

Peter Motzfeldt said...

Hi

I don't think access an accordion by index is implemented. I will see if I can provide you with a quick fix for that.

Ankur said...

So tell me another way to access the accordion except related_object..

Plz Tell me where i can download FunFx Tutorial...

Ankur said...

Peter can i open FunFx file in mozilla. If possible then tell me the solution.....

Peter Motzfeldt said...

The only tutorials is located under tests at funfx.rubyforge.org

But I will tonight try to create a quick fix for you to be able to use index.

Peter Motzfeldt said...

Do you mean run the tests with mozilla?

Ankur said...

yes........

Peter Motzfeldt said...

It is not possible to run the tests within other browsers than Safari on Mac and IE on Windows. Linux is not supported unless you run through some kind of emulator.

We are in motion with a facelift for FunFX and hopefully I will try to implement some support for Linux and maybe use Firewatir to enable support for Firefox. But for now no mozilla support.

Ankur said...

Thanks for telling me this information....

CoderInMaking said...

Have you ever tried IBM's RFT ? It has features such as Object Repository and verification points. Does your tool support these features currently?

Mykola said...
This comment has been removed by the author.
Mykola said...

Hi Peter, Would be possible to add an option to use RubyAMF as a Flex to Ruby channel? I guess, this way FuxFx would work for AIR. What do you think?

Srinivasulu T said...

Hi

I would like to automate flex GUI based (window) desktop application. Its not browser based and its thick client application. Whether FunFx will support to automate window based application?.

Thanks

qael said...

Is it possible to automate a flash application using FunFx when the flash is not developed by us.