多年来,我一直在观看 Ryan Bates 的 RailsCasts,而且我也是该网站付费部分的客户。我过去是通过观看 Cucumber 剧集来学习 BDD 的。
现在我已经了解了 TestUnit、RSpec、Capybara 和 MiniTest。我开始对什么是什么感到困惑。
这4个项目有什么区别?我知道显然 Cucumber 执行纯文本功能,我想这可以被认为是集成测试。
但现在我也看到最新版本的 Cucumber 需要 MiniTest?Cucumber 只是一个位于测试框架之上的 DSL 吗?
我也知道 RSpec 有自己的用于断言的语法糖,即“描述”块。MiniTest 似乎也支持这种语法。
我知道 Capybara 用于查看生成的网页内容,我想。
这是我的问题:
如果我正在创建一个新的 Rails 3.2 应用程序,我应该使用这些测试程序的哪种组合?额外有用的是一个列表,该列表解释了这些 gem 及其相关流程如何在适用的情况下相互补充,例如:
Cucumber is a DSL for driving BDD
Cucumber is for integration tests and is based on creating user stories that are customer-readable
It implements its tests behind the scenes via MiniTest
MiniTest is a new testing framework that comes with Ruby 1.9 and is very fast.
MiniTest is also used for unit testing, such as testing controllers and models
It does not yet have as many features as RSpec
Cucumber also uses Capybara to access DOM elements from a javascript-enabled browser simulator such as Selenium
When you test in Rails, you have the ability to do the following kinds of tests: controllers, views, models, and integration (MVC together)
Some people just do integration and model testing, because they feel that integration testing handles enough of the controller and view testing itself, and anything too complex can simply be moved up to the model
非常感谢您为我清除这些想法提供的任何帮助。