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
4.
出处: http://www.cnblogs.com/todototry/
关注语言: python、javascript(node.js)、objective-C、java、R、C++
兴趣点: 互联网、大数据技术、大数据IO瓶颈、col-oriented DB、Key-Value DB、数据挖掘、模式识别、deep learning、开发与成本管理
产品:
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 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 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架