Screencast: Testing Flex Apps with Cucumber – Take 2

I was not really happy with last week’s screencast I did on testing Flex with Cucumber. Effectively doing screencast is not an easy endeavor and trying to it myself is making me appreciate all the other screencast I watch so much more. So last week I just wasn’t comfortable while I recorded it, not sure why, but I thought I should try to capture it again. And the second time around I felt better, maybe I should alway take two takes (or even more :-). So here is the new one…

Screencast: Testing Flex Apps with Cucumber – Take 2 from daniel wanja.

To run this code you need to have all the gems installed. So config your Rails to run Cucumber with FunFx (in config/environments/test.rb):

config.gem "rspec", :lib => false, :version => ">= 1.2.7"
config.gem "rspec-rails", :lib => false, :version => ">= 1.2.7"
config.gem "webrat", :lib => false, :version => ">= 0.4.4"
config.gem "cucumber", :lib => false
config.gem "funfx"
config.gem "safariwatir"

Config Cucumber to have @flex available (in features/support/env.rb)

require 'funfx'
require 'funfx/browser/safariwatir'

browser = Watir::Safari.new
browser.goto("http://localhost:3000")

Before do
  @flex = browser.flex_app('flashContent', 'flashContent')
end

at_exit do
  browser.close
end

In the same file disable transactional fixtures

Cucumber::Rails.use_transactional_fixtures

Ensure that your Flex application is compiled with the funfx library and the automation library linked in.

<flex-config>
  <compiler>
	<include-libraries append="true">
		<library>../../lib/funfx-0.2.2.swc</library>
		<library>../../lib/automation.swc</library>
		<library>../../lib/automation_agent.swc</library>
		<library>../../lib/automation_dmv.swc</library>
		<library>../../lib/automation_agent_rb.swc</library>
	</include-libraries>
  </compiler>
</flex-config>

Leave a Reply

Your email address will not be published. Required fields are marked *