Functional testing of Flex-applications with Ruby

Examples


In the following link there some tests that is possible to run on the
test application These tests are ready to run, when the FunFX framework is installed (see Installation). When the gem is installed you need only to run the scripts.

Notice

You should load the test application in the browser (IE or Safari) once. If not the test might fail because the Flex application uses to long time to load.

This application is ment to be a source of both learning and knowledge. I hope we can build this application and test collection to a knowledgebase, where people can add code samples they find hard to test, or just add source samples on how to test different thing.

Howto add Flex code and tests

I have not been able to automate the process of adding components and tests for the test application. But automatically adding Ruby scripts to a server might not be the best idea anyway.

But I have added both the test application and the folder containing the tests to svn (FunFX svn at Rubyforge), so you can easily checkout this and update with new functionality or tests. I have also created an email address that can be used to send a flex component and/or tests to and I will add them as soon as I can.

The test application in svn is not automatically added to the web, but I will do that when I notice a change. You can also remind me with email, either with the new email address or the FunFX mailinglist.

Example

This example is created with the use of Test::Unit, but you can use any other testing tool that supports Ruby.
require 'test/unit'
require 'funfx'

class ButtonTest < Test::Unit::TestCase

def setup
@ie = Funfx.instance
@ie.start(true)
@ie.speed = 1
@ie.goto("http://location.of.application")
end

def test_control
assert_not_nil(@ie.button("nameOfButton"))
@ie.button("nameOfButton").click
assert_equal("Text", @ie.label("nameOfLabel").text)
end
end