访问次数
我的另一个总结性博客: 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 @   fandyst  阅读(512)  评论(2编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示