访问次数
我的另一个总结性博客: todototry 大米粒

Rspec在Rails项目中的使用

这是David Chelimsky写的一篇RSpec简明指南,原文在这里

简介

要了解RSpec,我们首先需要了解什么是行为驱动开发(Behaviour Driven Development,简称BDD),BDD是一种融合了可接受性测试驱动计划(Acceptance Test Driven Planning),域驱动设计(Domain Driven Design)以及测试驱动开发(Test Driven Development,简称TDD)的敏捷开发模型。RSpec为BDD开发提供TDD支持。

通常测试Rails项目需要一下gems.

1.cucumber                                                                                   ---最有前途的

黄瓜背景介绍:  https://github.com/cucumber/cucumber/wiki/Cucumber-Backgrounder

黄瓜使用1:   http://www.lycom.de/past/2008/11/28/cucumber01-2008-11-26/

黄瓜使用2:  http://www.lycom.de/past/2008/11/29/cucumber02-2008-11-27/

黄瓜使用3:  http://www.lycom.de/past/2008/11/30/cucumber03-2008-11-29/

黄瓜使用4:  http://www.lycom.de/past/2008/12/5/cucumber04-2008-12-05/

黄瓜相关:  http://www.lycom.de/past/tags/cucumber 

--资料汇总--:    http://chinaonrails.com/topic/view/2002.html

 Rspec-2 也就: 黄瓜    https://www.relishapp.com/rspec

1.Rspec 

官方文档:  http://rspec.info/documentation/

   http://www.letrails.cn/archives/20/

Rspec-2 也就: 黄瓜    https://www.relishapp.com/rspec

2.Capybara                                                  ----需要--》 Rack::Test and Selenium

Capybara aims to simplify the process of integration testing Rack applications, such as Rails, Sinatra or Merb. Capybara simulates how a real user would interact with a web application. It is agnostic about the driver running your tests and currently comes with Rack::Test and Selenium support built in. HtmlUnit, WebKit and env.js are supported through external gems.

A complete reference is available at at rubydoc.info.

可以配合cucumber使用。

rails generate cucumber:install --capybara

也可配合Rspec

主页: https://github.com/jnicklas/capybara

帮助文档: http://rubydoc.info/github/jnicklas/capybara/master



3.gem install selenium-webdriver                  ----自动测试框架for IE /Firefox/Chrome/Android/Iphone

WebDriver is a tool for writing automated tests of websites. It aims to mimic the behaviour of a real user,

and as such interacts with the HTML of the application.

http://code.google.com/p/selenium/

http://selenium.googlecode.com/svn/trunk/docs/api/rb/_index.html

http://seleniumhq.org/


4.


posted @ 2011-09-10 20:19  fandyst  阅读(511)  评论(2编辑  收藏  举报