我一直在觀看Ryan Bates的RailsCasts多年,而且我也是該網站付費部分的客戶。我從過去觀看黃瓜劇集學習了BDD。Rails 3測試框架混淆
現在我已經瞭解了TestUnit,RSpec,Capybara和MiniTest。我開始對什麼是什麼感到困惑。
這4項內容有何區別?我知道很顯然Cucumber執行純文本功能,我想這可以被認爲是集成測試。
但現在我也看到最近版本的黃瓜需要MiniTest? Cucumber只是一個位於測試框架之上的DSL嗎?
我也知道RSpec有自己的語法糖做斷言,「描述」塊。看來MiniTest也支持這種語法。
我知道Capybara用於查看生成的網頁內容,我想。
這裏是我的問題:
如果我創建一個新的Rails 3.2的應用程序,我應該用什麼這些測試程序的組合?什麼是額外有益的是解釋這些寶石及其相關的進程如何補充清單相互適用,如:
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
謝謝你這麼多,你可以提供給清除這些想法爲我的任何幫助。
非常有幫助。非常感謝DVG。 – Saim