为 ruby​​onrails 编写测试

发布于 2024-11-23 22:21:54 字数 131 浏览 3 评论 0 原文

我是为 rspect、steeak、cucumber 等 ruby​​onrails 应用程序编写测试的新手。我如何开始或学习才能帮助我编写漂亮的代码?

你可以举一些简单的例子或者一些我可以从零开始理解的网址。

谢谢

I am new to writing test for rubyonrails app like rspect, steak, cucumber etc. How do I start or learn so that it will help me to write beautiful codes?

You can give some simple example or some url where I can understand from zero.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

可爱暴击 2024-11-30 22:21:54

http://railscasts.com/episodes/155-beginning-with-cucumber - 适合初学者的好播客

The RSpec Book - 也非常有用

这是一个很好的起点,然后 Google 会帮助你

http://railscasts.com/episodes/155-beginning-with-cucumber - a good podcast for beginner

The RSpec Book - also very useful

It's a good point to start and then Google help you

不一样的天空 2024-11-30 22:21:54

1) 首先阅读 rails 测试指南,以了解测试的感受。

2) 熟悉各种测试框架(Cucumber、rspec、testunit、steeak、minitest ),观看截屏视频 (railscastsTeachMeToCode),然后尝试选择一个对您有吸引力的。

3)编写测试!并在需要时从 StackOverflow 获取帮助。如果您喜欢 RSpec,那么 RSpec 书 非常有帮助,但不是必需的。

我个人对框架的看法:
我一开始非常喜欢 Cucumber,但最终发现它非常冗长,而且我不喜欢使用它进行集成测试,然后使用 RSpec 进行单元和功能测试。我现在喜欢仅将 RSpec 与 Capybara 和 Shoulda 匹配器一起使用。 TestUnit 甚至可以比 RSpec 更简洁,但我个人认为 RSpec 是编写自记录代码和不过于冗长之间的折衷方案。

1) Start by reading the rails testing guide just to get a feel for testing.

2) Become familiar with the various testing frameworks (Cucumber, rspec, testunit, steak, minitest), watch screencasts (railscasts, TeachMeToCode) and then try and choose one that appeals to you.

3) Write tests!! and get help as you need it from StackOverflow. If you like RSpec then the RSpec book is very helpful, but not essential.

My personal opinion on frameworks:
I started out really liking cucumber but I eventually found it very verbose and I didn't like using it for my integration tests and then RSpec for my unit and functional tests. I now like using just RSpec with Capybara and Shoulda matchers. TestUnit can be even less verbose than RSpec but personally I find RSpec to be the happy medium between writing self documenting code and not being overly verbose.

您的好友蓝忘机已上羡 2024-11-30 22:21:54

几天前我刚刚开始使用 RSpec,这非常困难(实际上仍然如此)。您可以从railstutorial.org 开始。作者遵循TDD原则。更多信息请访问 RSpec黄瓜 github 页面。请务必查看维基百科。

I've just started with RSpec a few days ago and it was pretty hard (it still is actually). You could start from railstutorial.org. The author follows the TDD principle. More info available at RSpec and Cucumber github page. Be sure to check out the wiki.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文