Rspec 与 TestUnit [英] Rspec vs. TestUnit

查看:32
本文介绍了Rspec 与 TestUnit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始为我的 rails 3.0.8 应用程序创建测试套件的计划阶段.我正在尝试决定使用哪个测试框架/gems.通常我更喜欢尽可能地坚持 Rails 约定.但是,这意味着使用 TestUnit.有许多相互竞争的测试框架可供选择,它们是作为 TestUnit 的替代品而创建的.这些年来,TestUnit 是否变得更好,或者它不是一个很好的竞争者?

I'm beginning the planning phase of creating a testing suite for my rails 3.0.8 application. I'm trying to decide on which testing framework/gems to use. Normally I prefer to stick to Rails convention as much as possible. However, this means using TestUnit. There are many competing test frameworks to choose from that were created as an alternative to TestUnit. Has TestUnit gotten better over the years, or is it not a very good contender?

我也听说了很多关于 rspec 的好东西.rspec 和 TestUnit 在功能方面是否接近,还是 rspec 将 TestUnit 吹得一塌糊涂?

I've also heard of a lot of good things about rspec. Are rspec and TestUnit close in terms of functionality, or does rspec blow TestUnit out of the water?

无论我选择什么框架,我都希望它拥有良好的支持基础(大量用户和文档)、易用性/简单性和持久的未来.

Whatever framework I choose, I'd prefer it to have a good support base(lots of users and documentation), ease of use/simplicity, and a lasting future.

推荐答案

Test::Unit 和 Rspec 都是非常好的解决方案.至于我,我更喜欢在我的 Rails 项目中使用 RSpec - 因为它有许多自动解决方案,如自动测试、突出显示语法、rake spec 等快捷命令以及其他使使用测试更容易的东西.但在我的普通 ruby​​ 脚本中,我使用 Test::Unit - 当您不需要复杂的测试(集成和其他)时,它非常轻量级和直接

Both Test::Unit and Rspec are very nice solutions. As for me I prefer to use RSpec in my Rails project - because it has many automatic solutions like autotest, highlighting syntax, shortcut commands like rake spec and other stuff that make using test easer. But in my plain ruby scripts I use Test::Unit - it is very lightweight and staightforward when you don't need complex testing (integrational and others)

这篇关于Rspec 与 TestUnit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆