日期:2014-05-20  浏览次数:20783 次

8 what test framework should you use?

for integration test, i have no prefer between the default Test:Unit?

and?

Rspec.

?

just stick to one framework inside a project, no need to mix the two in one project.

?

A second option is?Cucumber, which works nicely with RSpec and allows the definition of plain-text stories describing application behavior. Many Rails programmers find Cucumber especially convenient when doing client work; since they can be read even by non-technical users, Cucumber tests, or “scenarios”, can be shared with (and can sometimes even be written by) the client. Of course, using a testing framework that isn’t pure Ruby has a downside, and I find that the plain-text stories can be a bit verbose and (cu)cumbersome. Since we don’t have any client requirements in?Rails Tutorial, and since I strongly prefer a pure-Ruby testing approach in any case, we’ll stick to RSpec integration tests in this book. Nevertheless, I suggest taking a look at some?Cucumber tutorials?to see if it suits you.