用Cucumber,FunFX测试Flex运用(Testing Flex Apps with Cucumber )

以下是详细的step by step的视频 http://www.onrails.org/articles/2009/07/08/screencast-testing-flex-apps-with-cucumber
,下面的步骤视频中都会讲到,只要按视频做就可以进入BDD测试flex的旅程了。

1. rails cucumberwithflex

2. 在environment.rb添加
config.gem "restfulx"

3. 在test.rb添加
rspec
rspec_rails
webrat
cucumber
safariwatir

4. 运行rake gems:install

5. 运用rake gems:install RAILS_ENV=test

6. 运行script/generate rx_config

7. 新建/db/model.yml,添加如下内容:
notes:
title:string
body:text

8. 运行script/generate rx_yaml_scaffold

9. 运行rake db:create:all

10. 运行rake db:migrate

11. 运行rake rx:flex:build

12. 运行script/server

13. 运行open http://localhost:3000

======================== Prepare the Flex App for FunFx============
14. open cucumberwithflex.mxml,添加如下代码:

	<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>


15. 拷贝flex builder的相关包到lib下

16. 从http://rubyforge.org/projects/funfx下载funfx-0.2.2.swc,放到lib下

17. 运行rake rx:flex:build

======================= Prepare for cucumber ===================
18. script/generate cucumber

19. 添加如下文件:
/features/manage.notes.feature
/features/step_definitions/notes_steps.rb

20. 在/features/suport/env.rb中require "funfx"等

好了,用cucumber测试flex的环境搭好了。可以运行cucumber features -t focus -s 进行测试了。

你可能感兴趣的:(xml,Flex,Rails,rspec)