0

我是 Rspec 的新手,我从电子书和在线博客中学习它。我对一些宝石有些困惑,我应该如何进行测试?他们对 Rspec 和测试的真正作用是什么?

这些宝石如下

gem factory_girl gem 'capybara
'
gem 'faker'
gem 'guard-rspec'
gem 'launchy'

我不知道为什么要使用它们以及在开始学习 Rspec 时应该使用哪个 gem?另一个问题是我应该在学习 Rspec 的同时进行单元测试还是功能测试?

请帮我。
谢谢。

4

1 回答 1

2

factory_girl is used as substitute for test fixtures, to generate objects with predefined data for use in tests;

capybara is a integration testing tool;

faker generates sample test data;

guard-rspec works with guard, an automated testing tool;

launchy takes web pages generated by integration tests and opens them in a browser

You can get a better idea what each gem does by finding it on Github and perusing the README. If you're looking for an introduction to RSpec, the RSpec docs are a good place to start. There are a number of tutorials that address testing -- eg. this one.

于 2012-05-17T04:11:37.890 回答