Saturday, November 17, 2007

FunFX - Getting started

At the website for FunFX at Rubyforge, there are some old direction on how to get started with FunFX. I will now make a better up-to-date getting started with FunFX (and hopefully get to update the website).

The first thing you need is to get Flex Builder from Adobe, and the FunFX zip file located at Rubyforge. The FunFX zip file contains three files;
  • AutomationGenericEnv.xml
  • FunFXAdapter.swc
  • FunFX-0.0.x.gem.
To get things to workyou will need additional three files, but they are part of the Flex 3 SDK (with Flex 2 SDK these files are bundled with Flex Data Services and the automation package, but you will be able to get the files from Flex 3 SDK) ;
  • automation_agent_rb.swc
  • automation_agent.swc
  • automation.swc.
The automation_agent_rb.swc must be located in the language folder in use in the locale folder. In the Flex SDK 3 version this file is already in place in the correct folder.

The FunFX gem file must be installed locally on your computer. It does not exist in any public repository yet, so you must choose the local gem file located in the FunFX zip file.

All the other files will be used when creating the Flex project, which I will begin explaining now. I will explain using Eclipse as the IDE.

Creating a new Flex Project
The first thing is to create the Flex project of choice. Then you must add the AutomationGenricEnv.xml to the root path of the project or just add it directly to the bin catalog or the output folder of choice. The adapter uses this file to build the automation environment of all display objects.

To be able to take advantage of the FunFXAdapter file you must add it as a compiler option as shown in the picture below. The adapter is relying on the files automation_agent.swc and the automation.swc files, and thus they must also be added as a compiler option.

I have tried to add these swc files as swc files in the build path but this does not work. I am not really sure why this is, so if anybody has any comments on this fact please let me know.



Now your application is ready to be tested. Remember to be consistent with giving all your display object uniq id's and the testing will be more efficient.

At the end of this post it is an important notice I have to give, and that is about different versions of Flex SDK's. It seems that Flex projects does not like swc files that is compiled with different SDK versions. Due to this the precompiled versions of the FunFXAdapter.s that is supplied with the FunFX zip file might not work with your application (the version out now ,FunFX version 0.0.2 is compiled with Flex SDK version 3.0.0). If this happens download the source code and compile your own version.

I hope this post will help you get started with FunFX, allthough I know I have not talked about how to write the actual tests. The next post will talk about how to write these tests with Ruby.

100 comments:

Neil Curzon said...

Hi, Peter! Thanks for taking the time to write this up. I've succeeded in most of the steps, with Flex Builder 3 eclipse plugin, but get an exception when finding a button:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.automation.delegates.containers::FormItemAutomationImpl/mx.automation.delegates.containers:FormItemAutomationImpl::getItemAutomationName()[C:\Work\flex\dmv_automation\projects\automation\src\mx\automation\delegates\containers\FormItemAutomationImpl.as:140]

when i call @ie.button("buttonthatdoesntexist"), it returns nil, but when i call it with @ie.button("btnSubmitLogin"), i get that exception from the flex app.

Any ideas

Peter Motzfeldt said...

Hi Neil

I am sorry for the late response, but I did not see the comment until now.

Hmm, I cannot recall to have seen that error. What version of Flex are you running?

Does this error happen when trying to reach any kind of buttons, or that special one. In a simple hello world application, are you able to click on a button?

Can you give me more info about your Flex application?

I am glad for these kind of responses, gives me more insight into how the framework should work. Thanks!

- Peter

Igor Deruga said...

Hi, Peter!
Nice post, thank you!

Though, there is a question about using Flex 2 SDK and FunFX. Assuming that I recompiled the FunFX component, where can I get the automation_agent.swc? In the article you say that I can use the ones bundled in Flex 3 SDK, but they can't be used with Flex2 compiler. So, I guess, the only way is to get it from the automation package, which requires DataServices license :(

Please, correct me if I'm wrong.

Sincerely,
Igor

Peter Motzfeldt said...

Hi Igor

That is correct, the automation files for the Flex 2 is not free. And you are correct that they do not match the Flex 3 version with the Flex 2 SDK.

Paromita said...

Hi Peter,

Thanks for the nice post.
I am getting a compilation error when I try to compile the Flex app. I am using Flex Builder 2 and have the Automation swc files compatible with Builder 2.
I have downloaded the FunFX-0.0.3.zip file from the net and have done the mentioned installation processes but when I try to compile the appliaction I am getting two errors -
a) An internal build error has occurred. Please check the Error Log.
b)unable to load SWC FunFXAdapter.swc

I have added the proper compilation arguments as mentioned in your post.
Please advice as what should I do solve the problem?

Thanks and Regards,
Paromita

oldyew said...

Hi Peter!
Thank you for your application and documentation about using.
Could you please post a small description or give a link where to read how create Flex projects in Eclipse. Which plugin do you use?
I try to follow you installation description, I can't find a way to continue with flex project creation.
Thanks a lot!

I'm a newbie in coding (i'm a tester) but on our current project we need to perform automated testing of flex application and I'd like to try to use you solution.

Vivek said...

Hi Peter,
I have a question from a Testing perspective. can we get Funfx to work something like what watir does? I have a webpage with a FLex control in it i had automated the whole app with WATIR my question is can i add Funfx to the existing WATIR to automate the flex control.

Thanks in advance

Vivek

Asher said...
This comment has been removed by the author.
Asher said...
This comment has been removed by the author.
QT said...

Hi Peter,
Your compiler options don't include automation_dmv.swc. Per Adobe, quote: "If your application uses charts or the AdvancedDataGrid classes, you must also add the automation_dmv.swc file" (from http://livedocs.adobe.com/flex/3/html/help.html?content=functest_components2_03.html). Could you comment?
Thanks

gauri said...

Hi Peter...Thanks for the post.
Nice Work!

I have a question yo ask you regarding the usage of 'goto' statement....how do we access the objects of the mxml page loaded usong swf loader?Also how do you test and load multiple mxml pages of the same application.....ie,how do u use goto statement for each page????

Unknown said...

Hi Peter:
Thank you for Funfx.
I am running into error when I attempt to automate our application with Funfx. I got as far as using goto and set the flex object. Beyond that I get NoMethodError: private method 'split' called for nil:NilClass
e:/ruby/lib/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:33:in 'method_missing' ...
Any idea how to get around this?
Thanks,
Tony

Unknown said...

Peter:
Do you know where a QA like myself can download a copy of FunFXAdapter from Flex SDK 2.0. Our flash guy is not keen on helping me out.
Thank you,
Tony

Peter Motzfeldt said...

I am sorry everybody. I have missed all the comments. Forgot to get notified if followups.

Yuri: I hope you have gotten further on the Flex project development. Let me know if you need any pointers.

Vivek: Yes, with the 0.0.4 version you can hook Watir on FunFX, but not wice-versa, but this is comming in the next release.

QT: I have not been using any of these controls until today, and noticed that I need that swc yes. So I am working on the fix. Thanks.

Gauri: FunFX does not for the moment support swf's loaded with the swf loader. The goto is only for the browser to go to the specified address. The navigation within the Flex is done with the Flex controls; buttons, tabs etc.

Moomoo: Have you worked it out? I can give you a version compiled for Flex 2 if you still needs it?

Stinky Trash said...

Hi Peter thanks for the getting started document.

I was trying to test
http://funfx.rubyforge.org/Flex/FlexRepeater/FlexRepeater.html

and it gave me the following error

1) Error:
test_insert_product(TestProductOne):
WIN32OLERuntimeError: unknown property or method `isSynchronized'
HRESULT error code:0x80020006
Unknown name.
H:\funfxrubygem\gems\FunFX-0.0.4\lib/flex.rb:106:in `method_missing'
H:\funfxrubygem\gems\FunFX-0.0.4\lib/flex.rb:106:in `is_sync'
H:\funfxrubygem\gems\FunFX-0.0.4\lib/flex.rb:28:in `method_missing'
C:/Documents and Settings/abiswas/MSDE/eclipseide/3.3prod/workspaces/default/FunFXRuby/test_product_one.rb:19:in `test_insert_product'


any ideas?

Peter Motzfeldt said...

Hi, are you still havin this problem?

Stinky Trash said...

Hi Peter,

The problem got solved. Though I didn't change anything ( or may be i did something accidentally). I restarted eclipse and retried and it worked !!

Thanks
Ari

Unknown said...

I am having the same problem as posted above by Moomoo

I got as far as using goto and set the flex object. Beyond that I get NoMethodError: private method 'split' called for nil:NilClass
e:/ruby/lib/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:33:in 'method_missing' ...
Any idea how to get around this?

Peter Motzfeldt said...

Hi, are you getting this when you try to run against the test application or some of your own tests?

Alok said...

Hi Peter,
I really liked FunFx tool and looking forward to automated my UI and Functional Test cases using this tools.

I have following query on Funfx:
1. While evaluating with a sample application i was not able to find any event for DataGrid UI object to get text from the data grid.

I would appreciate if can you suggest some work round for this?
Regards,

Peter Motzfeldt said...

Hi

To get information out of the datagrid you can use the tabular_data method. This method returns a string that is comma separated.

You can invoke it like this:

@ie.data_grid("dgFripoliser").tabular_data(:start => 0, :end => 9))

Start and end will choose what rows to export.

Hopes this helps!

Unknown said...

I am getting the split error when running some of my own tests against our application.

I can run the tests against the sample application using the sample tests.

Alok said...

Hi Peter,

Thanks a lot for your instant reply. i was able to get the data from Data Grid using the solution provided by you.

But i am wondering how tabular_data event worked on data grid even though its not mentioned in the XML file.

Does this ClassInfo Name="DataGrid" Extends="ListBase" SupportsTabularData="true" makes it work? If yes then what all events/properties of tabular_data can be used with various objects?

Thanks in advance...

Regards

Peter Motzfeldt said...

Hi

Yes that is true, it is because of the yes. If it is yes then the add_tabular_method is run in the xml_parser.rb file

- Peter

Unknown said...

Hi Peter

I am trying to get FunFX working with our flex application.
I can run the sample tests against the sample application. But when i try to do anything on our application it seems to return everything as nil.



I Believe i am using the correct name for the elements as i got them from a flex spy.
if i do an assert not null on the objects i get "/<"nil"/>" expected to not be nil.

I am assuming i have the right declaration for the elements as if i change it to something else
The error i get is:
NoMethodError: private method `split' called for nil:NilClass
C:/Ruby/lib/ruby/1.8/flex.rb:33:in `method_missing'
C:/funfx/button_bar_testCC.rb:18:in `test_control'


Any ideas what i could be doing wrong.

Thanks

Fergal

Peter Motzfeldt said...

Hi, have you remembered to compile the Flex application together with swc files?

Unknown said...

Hi Peter

I have compiled the flex app with the automation and Funfx swc files and i have the AutomationGenericEnv.xml in the root directory of the app

RSP said...

Hi Peter,

I got an error.

WIN32OLERuntimeError: unknown property or method `isSynchronized'
HRESULT error code:0x80020006
Unknown name.
c:/Ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:106:in `method_missing'
c:/Ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:106:in `is_sync'
c:/Ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:28:in `method_missing'
work_group_test.rb:19:in `test_login_pp'

I have included the following files in the Flexcomplier.
-locale en_US-include-libraries "C:\Work\FunFX-0.0.3\FunFX-0.0.3\FunFXAdapter.swc" "C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\libs\automation_agent.swc" "C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\libs\automation.swc"
.

how to resolve this.

Thanks.,

Unknown said...

Hi Peter!

Am a beginner is automation at such level.. although i have an exp on tools like QTP. I have a flex application to test on.. I heard about FunFx so was a but curious to learn it..
I have downloaded the FunFX-0.0.4 and Flex builder 3 is in download process..

Could you please guide me step by step on how to install it and what exactly is to be done to make it work...

It would be of great help to me.

Thanks in advance...

Mayank

Peter Motzfeldt said...

Hi, I would download the new 0.2.2 version instead.

I have not yet had the time to write an howto on the new version, but will get that done this weekend.

For now use this:
http://martincik.com/?p=20

But just ask me anything if you get stuck or need any help!

srivalli said...

c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in `load_missing_constant': uninitialized constant Funfx (NameError)
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:77:in `const_missing'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:89:in `const_missing'
from flex.rb:6


Getting this error when trying to execute the funfx example code
can you help me on this

Peter Motzfeldt said...

Hi, what version do you use, the new 0.2.3?

Maybe it will work if you require 'rubygems'

What example more specific?

srivalli said...

require 'watir'
require 'test/unit'
require 'funfx'

watir = Watir::IE.new
flex = Funfx.instance
flex.attach(watir.ie, true)

#flex.goto("http://funfx.rubyforge.org/Flex/FlexObjectTest/FlexObjectTest.html", "FlexObjectTest")
flex.goto("C:/Documents and Settings/svaliveti/My Documents/Flex Builder 3/F3GSE Part I - Simple RIA/bin/FlickrRIA.html","FlickrRIA")
flex.tree("objectTree").open(:item_renderer => "Menu controls")
flex.tree("objectTree").select(:item_renderer => "MenuBar1")

I am using funfx0.0.2

srivalli said...

I just want to open the flex application
but getting exceptions...
I am using watir tool

Peter Motzfeldt said...

I would recommend getting the new version 0.2.3 if you are just starting with FunFX.

Is that possible for you?

srivalli said...

Hi Peter,
I have just started working on funfx

I am not able to get funfx0.2.3 version
i have downloaded 0.2.2 but inthat i dint find funfxadapter.swc file

hot to install it and where can i get that version?

presently i have installed funfx 0.0.2 version and installed funfx gem also through gem install from command prompt.

can you please help me on this

Peter Motzfeldt said...

I am very sorry, I meant 0.2.2 :-)

Here is the swc:
http://rubyforge.org/frs/download.php/48619/funfx-0.2.2.swc

And the gem you can install by:
gem install funfx

srivalli said...

Hi Peter
I have already downloaded the swc and gem files but i dint get funfxadapter for 0.2.2 version can i use the funfx adapter of 0.0.2 version

or i need to download it......

Peter Motzfeldt said...

Sorry about the lack of documentation, but the funxf-0.2.2.swc is the new funfxadapter.swc

Use that like you did with funfxadapter.swc

srivalli said...

sorry i dint even get the automationgenericENv.xml
which we get in zip folder for 0.0.2 version

Peter Motzfeldt said...

The xml file is now built into the swc, so you do not need to think about that one. I the next release though you will be able to choose wether to use your own or the one compiled into the swc.

srivalli said...

hi Peter
thanks for your quick response

still i am getting the same exception

flex=Funfx.instance

getting exception at this point of script.

Peter Motzfeldt said...

The new version is a bit different in setup, take a look at this page
http://wiki.github.com/peternic/funfx

Let me know if you still get stuck.

srivalli said...

still getting the same problem with IE

Peter Motzfeldt said...

Hi, forgot to mention that the new version has a bug when it uses IE, so use Firefox. You must install a JSSh plugin, howto is right here http://wiki.github.com/peternic/funfx

srivalli said...

Even i tried with firefox getting exception for JSSh
ihave installed jssh and when trying to give command telnet localhost 9997 getting connect failed.
Previously i have worked on it successfully even i got the connect failed exception
but now not able to run scripts using firfox

Intekhab Sadekin - Toolsmith said...

i am getting the following error. I cant really figure out why this might be happening. COuld any please help me out.

c:/ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:106:in `method_missing': unknown property or method `isSynchronized' (WIN32OLERuntimeError)
HRESULT error code:0x80020006
Unknown name. from c:/ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:106:in `is_sync'
from c:/ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:28:in `method_missing'
from flextest.rb:17

Peter Motzfeldt said...

Hi, are you using the 0.2.2 version? If so, IE is not supported for the moment. A bug fix for IE will be out in a couple of days.

In the mean time use Firefox (http://wiki.github.com/peternic/funfx)

Rashmi said...

Hi,
I am getting an error:

C:/Ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:106:in `method_missing': unknown property or method `isSynchronized' (WIN32OLERuntimeError)
HRESULT error code:0x80020006
Unknown name.
from C:/Ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:106:in `is_sync'
from C:/Ruby/lib/ruby/gems/1.8/gems/FunFX-0.0.4/lib/flex.rb:28:in `method_missing'

I am using flex builder3 and funfx0.0.4. Please suggest..i have included all the required autiomation.swc files in compiler options.

Intekhab Sadekin - Toolsmith said...

@rashmi: I strongly recommend you to get the latest version of funfx which is funfx0.2.2. I faced the same problem and upgrading to the latest version actually did the trick unless ofcourse you have messed up somewhere else.

Rashmi said...

I have downloaded funfx-0.2.2.gem but when i install it from the command prompt i am getting an error:

ERROR: Error installing funfx-0.2.2.gem:
funfx requires fastercsv (>= 1.4.0, runtime)

please suggest.

Peter Motzfeldt said...

Hi try to do a gem install fastercsv

- Peter

Rashmi said...

i am trying to get the gem for fastercsv but not able to get it from rubyforge.org. 'Failed to resolve the name of server rubyforge.org to connect'. Is there any alternative to get it?

Intekhab Sadekin - Toolsmith said...

@rashmi: uninstall the older version of funfx and then install the newer version.
$ gem uninstall funfx
$ gem install funfx

The last command would actually look for the latest release and try to install that. Hope that works.

@Peter: What would installing fastercsv help accomplish?

Peter Motzfeldt said...

FunFX has a dependency to fastercsv, and if it is not installed an error will appear, if fastercsv was not installed while installing the funfx gem

Can see if you have fatsercsv with gem list --local

Intekhab Sadekin - Toolsmith said...

@Peter: I have installed and worked with funfx without having to install fastercsv ever. I still dont see the need for it. Hope you could give me an example and a scenario.

Rashmi said...

i have uninstalled older version but the same error with newer version for fastercsv.

Intekhab Sadekin - Toolsmith said...

@ Rashmi: Could you please send me the list of gems that you have installed?
$ gem list

Intekhab Sadekin - Toolsmith said...

Well, if nothing happens, then I think you should try to install fastercsv. Do not try the 'gem install fastercsv' command. Try to download the gem manually from the net(which should be trivial) and then go to the location of the downloaded gem and run the command
$ gem install fastercsv-1.4.0

Rashmi said...

here is the list:
fxri (0.3.6)
fxruby (1.6.16)
hpricot (0.6.164)
log4r (1.0.5)
ptools (1.1.6)
rake (0.8.1)
ruby-opengl (0.60.0)
test-unit (2.0.1)
watir (1.5.3)
win32-api (1.2.1, 1.2.0)
win32-clipboard (0.4.4)
win32-dir (0.3.2)
win32-eventlog (0.5.0)
win32-file (0.5.5)
win32-file-stat (1.3.1)
win32-process (0.5.9)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.2.4)
windows-pr (0.9.3)

Rashmi said...

Can anybody please forward me the gem for fastercsv? rubyforge.org is down today...

Intekhab Sadekin - Toolsmith said...

I guess you will have to wait then. Or, I have it downloaded. I can mail it to you if you want.

Rashmi said...

@Intekhab Sadekin - Toolsmith: can you please send me the gem?

Intekhab Sadekin - Toolsmith said...

Yes i could but I do not have your email.

Rashmi said...

sorry but its in the profile: rashmi.aghor@gmail.com

Intekhab Sadekin - Toolsmith said...

Sent!!! :-)

Rashmi said...

Thanks a lot for the help. i could install funfx 0.2.2. Now i am getting another problem. At Funfx.instance i am getting an error:
test_myfunfx(MyFunFxTest):
NameError: uninitialized constant MyFunFxTest::Funfx
C:/MyProjects/MyFunFx/bin-debug/my_fun_fx_test.rb:13:in `setup'
Is the newer version still has problem with IE?

Intekhab Sadekin - Toolsmith said...

I am sorry dear but the newer version of funfx still does not have support for IE. Use firewatir instead. I faced the exact same problem. So, I had to resort to firefox as the dominant browser for testing flex applications. You will find firewatir inside the funfx installation folder. The exact location is C:\ruby\lib\ruby\gems\1.8\gems\funfx-0.2.2\lib\funfx\browser.

At the start of your class just include the firewatir library as the following:

require 'funfx'
require 'funfx/browser/firewatir'

You might also want to install firewatir seperately. The latest release is the 1.6.2 version. If you install that you will have access to the API for manipulating the browser. You might want to have a look at the source; its helps alot.

Rashmi said...

I installed firewatir version 1.2.0 and using the code below but still getting the error test_myfunfx(MyFunFxTest):
NameError: uninitialized constant MyFunFxTest::Funfx
C:/MyProjects/MyFunFx/bin-debug/my_fun_fx_test.rb:13:in `setup'

Code:

require 'test/unit'
require 'rubygems'
require 'funfx'
require 'funfx/browser/firewatir'

class MyFunFxTest < Test::Unit::TestCase
def setup
@ie=Funfx.instance
@ie.start(true)
@ie.speed=1
@ie.goto("file:///C:/MyProjects/MyFunFx/bin-debug/MyFunFx.html","MyFunFx")
end
def teardown
@ie.unload
end
def test_myfunfx
@name="James"
@ie.inputField("tTextArea").input(:value => @name)
@ie.button("bClickMe").click
end
end

Can the problem be resolved installing the newer version of firwatir or do i need to change my code?

Intekhab Sadekin - Toolsmith said...

I have re-written the test for you. Hope it works. Let me know if it doesnt.

require 'funfx'
require 'funfx/browser/firewatir'

class MyFunFxTest < Test::Unit::TestCase
def setup
@ff = FireWatir::Firefox.new
#@ff.goto("your desired website")
@ff.goto("http://www.google.com")
end

def teardown
@ff.close
end

def test_myfunfx
@name="James"
#this is where you need to find the id or name of the text field
#I am guessing the name of the textfield is tTextArea
@ie.text_field(:name=>"tTextArea").set(@name)
@ie.button(:name=>"bClickMe").click
end

Rashmi said...

Thanks a lot for your help. Now i am getting different error at
@ff.text_field(:id=>"tTextArea").set(@name)

FireWatir::Exception::UnknownObjectException: Unable to locate object, using id and tTextArea
C:/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.2.0/./MozillaBaseElement.rb:866:in `assert_exists'
C:/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.2.0/./htmlelements.rb:1374:in `set'
C:/MyProjects/MyFunFx/bin-debug/my_fun_fx_test.rb:21:in `test_myfunfx'

Intekhab Sadekin - Toolsmith said...

Now I think you are on the right track. The error that you got now occured because the code that you have written is looking for an element with the id tTextAtrea which it cannot find. Help me out here. Is the element declared using an id or name? Is tTextArea an id or name of the input field?

Rashmi said...

yes it is an id for a text area component.

Intekhab Sadekin - Toolsmith said...

Instead of @ff.text_field(:id=>"tTextArea").set(@name)
try @ff.text_area(:id=>"tTextArea").set(@name)

Peter Motzfeldt said...

Hi

You are mssing the step where funfx finds the actual flex object after the @ff.goto method call

@ie = @ff.flex_app('my-funfx-flex-application-id', 'my-funfx-flex-application-name')

Hope this helps :-)

Intekhab Sadekin - Toolsmith said...

@Peter: I dont think she has reached the flex application yet. She is trying to login to the flex application and the login page is jsp otherwise she would have had to search for a text area or a text field.

Peter Motzfeldt said...

Ok, then I misunderstood :-)

Rashmi said...

Thanks Peter. Now the error is:
FireWatir::Exception::ObjectReadOnlyException: Textfield id and tTextArea is read only.

Intekhab Sadekin - Toolsmith said...

@rashmi: I think the test is running too fast. Try to put a sleep before populating the text area. The code is:
Sleep 5 #it will speel for 5 seconds

Intekhab Sadekin - Toolsmith said...

Sorry for the typo.

Scorpion said...

Hi Peter/ToolSmith/Rashmi

Anyone please tell me if the issue with IE using V0.2.2 is now fixed? I am just now started automating my application, I have v0.0.4 with me and I strongly need to use only IE 7.0. Please let me know if I can use v0.2.2(latest version as per my knowledge) now??

Also any info about newer version than v0.2.2(if any) could serve the purpose?

Finally, it would be great help iff any one can provide me direct links to download v0.2.2 and any newer version.

Please respond ASAP as I am planing to start it today !!

Thanks,
Panni

Also please

Intekhab Sadekin - Toolsmith said...

I think the best person to answer this would be Peter. As far as I know, the latest version of funfx has not been released yet.

Scorpion said...

Hi peter,

Could you please look in to my above request and provide info, if the V0.2.2 IE issue is fixed. And also I believe that the number steps using v0.0.4 has been reduced in v0.2.2 (as per the conversation with Rashmit). Can u please provide brief steps(3 to 4) about Flexadapter and agentprocess.swc etc.. inclusions using v0.2.2. This would help beginners like me alot as we do not have to know the earlier process :).

Waiting for your response,
~ Panni

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

Hi Toolsmith,

Thanks for the information. Seems like still funfx0.2.2 have problems with IE 7.0, I got unintialised constant errors when tried. Hence I shifted to Firefox now and its working. I am successfull to automate the application till I reach the page with swf file, but can u plse tell me how to use below syntax to access objects in SWF ?

"@flex = @ff.flex_app('my-funfx-flex-application-id', 'my-funfx-flex-application-name')"

Please eloborate on what is "application-id" and "application-name" ... :(

Waiting for the response
~ Panni

Scorpion said...

Hi Toolsmith / Peter,

I have succeeded in finding the application-id and application-name. Now I am struck with below thing,

Actuall I have built a small sample swf file and deployed the html wrapper in tomcat server. The swf have a button labeled 'Click' and :id=>'Btn' and when clicked on it, a label will get visible and display a message.

I have written below code for this to automate,

require 'funfx'
require 'funfx/browser/firewatir'

@ff = FireWatir::Firefox.new
@ff.goto("http://localhost:8080/Myproject/bin-debug/Myproject.html")

@flex = @ff.flex_app('Myproject', 'Myproject')
#@flex.button(:automationName => 'Click').click
@flex.button(:id => 'Btn').click

When I run the above code, its not throwing any error but simply opened the html file having swf and then no action is performed. As per my code the button 'Click' should be clicked - but its not happening and also to my surprise no error is generated.

Please help me in moving forward with automation.

A quick response will help me a lot .. I only find time on weekends to explore the things!!

~ Panni

Scorpion said...

Any one please help me out ... check my above request ... its nearly a week I am waiting for the solution .. plse reply ASAP

~ Panni

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

Hi Peter/ Toolsmith,

Thanks for the software. I have succeeded in automating the sample application.

But when I tried to implement the same on another application, I found that the swf used in the application doesn't have application_id, it has only application_name. I was able to record the actions on it, but when I am using the same action script in ruby program the actions are not replayed. I guess if the ID of the swf is the main problem.

Can any one please help me, how to assign ID to the swf application.

~ Panni

Scorpion said...

Hi peter,

I was able to automate the application successfully when it directly loads in HTML wrapper (i.e., first page application has swf file). But I am unable to recognise the objects in swf when it is present in 2nd/3rd page(in middle) of website.

I am using the @flex = @ff.flex_app('application_id','application_name') in the script just before the page with swf loads. but still I am unable to access objects. Please help!!

~ Panni

Unknown said...

Hi peter,
I had used funfx 0.2.2 4-5 weeks back and my automation using that version was working well!
Since after that I had to test automation on IE, so I switched back to older version of funfx. Now again I am using latest version (0.2.2) but now I am having same problem as Panni had in last post July 4, 2009 2:12 PM (No error, no actions take place in automation).
Plz help me. What software I have to install Or changes I have to make.

Thanks and Regards,
Kaustubh

Sergey said...

Hi Peter,

I got the following error when execute a simple script:

require 'funfx'
require 'funfx/browser/firewatir'


BROWSER = FireWatir::Firefox.new
BROWSER.goto("path_to_my_app")

@flex = BROWSER.flex_app('FlexObjectTest', 'FlexObjectTest')

Error:
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant Element (NameError)
from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in `const_missing'
from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:92:in `const_missing'
from C:/ruby/lib/ruby/gems/1.8/gems/funfx-0.2.2/lib/funfx/browser/firewatir.rb:14
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from test1.rb:2

However FunFX 0.0.4 version works

Can you help me?

Sergey said...
This comment has been removed by the author.
Sergey said...
This comment has been removed by the author.
Vikas said...

Hello Peter,
I hope you are doing well !
I am trying to introduce FunFx 0.2.2 into our enterprise for Flex related automation testing for our product suite. During the evaluation of the tool we came across issues like
if the Flex application is embedded into the wicket frames then the flex_app is not recognized. To overcome this issue we removed the Wicket FRAME wrappers from our application, so far, we are able to get to the flex application through FunFX. The problem which we are facing now is when we run the FunFx script the script runs no error is reported but nothing happens as result of it.

Also if I am changing require 'funfx/browser/watir' to run over firewatir , this results in to errors :

Here is the script I am using:


require 'rubygems'
require 'funfx'
require 'funfx/browser/watir'
require 'watir'
include Watir
require 'test/unit'
class TC_recorded < Test::Unit::TestCase
def test_recorded

ie = Watir::IE.new
ie.close_others
ie.goto("http://172.19.0.7:8080/ALNTQA")
ie = Watir::IE.attach(:title, "Alert Enterprise")
ie.text_field(:name,'userName').set('admin')
ie.text_field(:name,'password').set('admin')
ie.button(:name,'logIn').click
sleep 2
shell = WIN32OLE.new('Shell.Application')
windows = shell.Windows
i = 0
windows.each {
|w|
i+=1
}

x = i-1
w_url = windows.Item(x).LocationURL
$ie = Watir::IE.attach(:url, w_url)
#puts "$ie attached to >> " + x.to_s + " " + $ie.url
#ie=$ie.url
puts ie
sleep 2
ie.span(:text,"Access").click
sleep 2


shell = WIN32OLE.new('Shell.Application')
windows = shell.Windows
i = 0
windows.each {
|w|
i+=1
}
x = i-1
w_url = windows.Item(x).LocationURL
ie = Watir::IE.attach(:url, w_url)
#puts "$ie attached to >> " + x.to_s + " " + $ie.url
@flex=ie.flex_app('flexUI',"ALNTAccessUIFxApp")
puts "Connected to Flex .... ALNTAccessUIFxApp ...."
sleep 2

if @flex.label({:automationName=>"Create New Request",:id=>'_ALNTDescriptiveButton_ALNTLabel1'}).text=="Create New Request" then
puts "into Flex Create Request"
end

@flex.image(:id => '_ALNTDescriptiveButton_Image1').click(0)
@flex.image(:id => '_ALNTDescriptiveButton_Image1').click


end
end


--- Here is the output of the script:
Loaded suite test12
Started
#
Connected to Flex .... ALNTAccessUIFxApp ....
.
Finished in 27.782 seconds.

1 tests, 0 assertions, 0 failures, 0 errors


------


Here are the errors for firewatir:

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant Element (NameError)
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
from C:/Ruby/lib/ruby/gems/1.8/gems/funfx-0.2.2/lib/funfx/browser/firewatir.rb:14
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from test12.rb:3


Also, we had followed all the steps for the configurations and the steps required for the Flex builder complier options as mentioned in your blogs.

I appreciate your valuable time, support and valuable help.

Thanks and Regards,
Vikas

IDEAZ RIBBIT said...

Hi ,

It will be a great help if anyone can give me some pointers for resolving problem described by Keen. Iam also facing the same problem..
Thanks in advance

AlciaNicole said...

Hi

Does FunFX works with Flex 4?

Unknown said...

Hi, I also had the active_support error. I solved this by uninstalling firewatir 1.6.5 and install version 1.6.2

Obviously, there is something in either firewatir 1.6.5 and/or funfc 0.2.2 which generates a conflict.

Cheers,
John

Lemuel said...

Hi John,
Thanks for sharing this. downgrading to firewatir 1.6.2 from 1.6.5 does the magic.

>gem uninstall firewatir

>gem install firewatir -v 1.6.2

Sadik said...

Can FunFux support to flexBuilder 4.5