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.


作者: fandyst
出处: http://www.cnblogs.com/todototry/
关注语言: python、javascript(node.js)、objective-C、java、R、C++
兴趣点: 互联网、大数据技术、大数据IO瓶颈、col-oriented DB、Key-Value DB、数据挖掘、模式识别、deep learning、开发与成本管理
产品:
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
原文地址:https://www.cnblogs.com/ToDoToTry/p/2173319.html