如何使用 Cucumber 创建 Rails 应用程序
我是黄瓜新手。我想使用黄瓜创建示例应用程序。 我正在使用 Windows 7 操作系统。有人可以指导我吗?
谢谢。
I am new for cucumber. I want to create on sample application using cucumber.
I am working on Windows 7 OS. Can any one guide me?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为这是两个独立的问题:
在 Windows 上构建 Rails 应用程序
使用 Cucumber 构建 Rails 应用程序(使用 Cucumber 提倡的原则,如 BDD、示例规范 和由外而内的工作流程)
在 Windows 上构建 Rails 应用程序
有很多教程,最好的起点可能是:
这是 很好的帖子,提供了在 Windows 下运行 Rails 的建议。
使用 Cucumber 构建 Rails 应用程序
Book Rails 3 in Action 就是一个很好的例子曼宁。
这本书非常擅长展示如何使用 Cucumber 通过示例规范从外到内创建应用程序。
本书的每一章都实现了一个新功能。几乎没有屏幕截图来解释这些功能。相反,作者在每章开头使用 Cucumber 场景来准确指定作为给定章节主题的所需新行为。然后他们展示并解释实现该功能所需的必要步骤和代码。
这是迄今为止我发现的将 Cucumber 与 Rails 结合使用的最佳示例。
这也是一个非常好的例子,如何使用示例规范来建立共同的理解 - 自教学以来一切都是为了分享理解。
然而,书中的场景非常注重在 UI 级别上指定行为……这并不被普遍认为是最佳实践。但对于教授 Rails 来说这是很棒的。
Rails 3 in Action 仍处于早期访问计划中。我不知道官方消息来源在哪里。
但是当您在 GitHub 上搜索时,您已经找到了示例应用程序 (Tiketee) 的不同实现:
https://github.com/rubykr/ticketee
https://github.com/oMartell/ticketee-rails-3-in-行动
https://github.com/rails3book/ticketee
I think these are two separate problems:
Building a Rails application on Windows
Building a Rails application with Cucumber (using principles promoted by Cucumber like BDD, Specification by Example and an outside-in workflow)
Building a Rails application on Windows
There are a lot of tutorials, best starting point is probably: Getting Started with Rails on Rails Guides.
However the official advice there is using a virtual machine with Linux :-)
Here is a good thread with advice for running Rails under Windows.
Building a Rails application with Cucumber
An extraordinary example for this is the Book Rails 3 in Action by Manning.
This book really excels at showing how to create an application outside-in with Specification by Example using Cucumber.
In each chapter of the book a new feature is implemented. There are almost no screenshots explaining those features. Instead the authors are using Cucumber scenarios at the beginning of each chapter to exactly specify the desired new behavior that is the topic of given chapter. Then they are showing and explaining the necessary steps and the code that is needed to implement the functionality.
This is the best example I have found for using Cucumber with Rails so far.
This is also a really great example how Specfication by Example can be used for building a shared understanding - since teaching is all about sharing understanding.
However the scenarios in the book are quite focusing of specifying behavior on the UI level ... which is not commonly agreed on being best practice. But for teaching Rails it is great.
Rails 3 in Action is still in the early access program. I don't know where the official sources are.
But when you search on GitHub you already find different implementations of the example application (Tiketee):
https://github.com/rubykr/ticketee
https://github.com/oMartell/ticketee-rails-3-in-action
https://github.com/rails3book/ticketee
这里是指南如何做。
Here is the guide how to do it.
我发现一个有趣的网络广播视频就是这样做的。
基本过程是定义 Cucumber 的几个特征。 (实际上是小黄瓜语言)
运行 cucumber
修复错误
重复
2 个步骤,直到您获得
工作应用程序。
它使用了一些 RoR gem,例如 webrat 和 rspec。
http://railscasts.com/episodes/155-beginning-with-cucumber
I found an interesting webcast video that does just this.
The basic procedure is define a couple features in cucumber. (actually the gherkin language)
Run cucumber
Fix errors
Repeat the
2 steps until you have a
working app.
It makes use of a few RoR gems like webrat and rspec.
http://railscasts.com/episodes/155-beginning-with-cucumber