是否可以在没有 JRuby/gems 的情况下直接在 Java 中运行 Cucumber?
我对 Cucumber、JRuby、Gems 及其工作原理还很陌生。
我喜欢用简单的英语写下测试用例的想法,但我并不热衷于安装很多新工具(我真的很喜欢 Java),只是为了让 Cucumber 启动并运行。
所以我有几个问题。
1)我需要安装JRuby/Ruby才能在Java中使用Cucumber吗?没有办法避免这种情况吗?
2)如果没有,是否有类似于 Cucumber 的替代测试工具,可以在 Java 中开箱即用?
为了让 Cucumber/类似工具正常工作,我必须有哪些替代方案来最大限度地减少新工具?
I am new to Cucumber, JRuby, Gems and how it works.
I like the idea of writing down the test case in plain English, but I am not keen on installing a lot of new tools (I really really like Java), just to get Cucumber up and running.
So I have a few questions.
1) Do I need install JRuby/Ruby to use Cucumber in Java? No way to avoid this?
2) If not, are there alternative test-tools, that is similar to Cucumber, that works in Java out of the box?
What alternatives do I have to minimize new tools just to get Cucumber/similar-tool working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Cucumber-JVM 就是您正在寻找的。
Cucumber-JVM is what you are looking for.
Cucumber 的一个成熟的纯 Java 替代品是 JBehave
另外 Aslak Hellesoy(Cucumber 的创建者)承诺提供原生 Java 版本的 Cucumber将于 2011 年发布(请参阅他的 CukeUp 主题演讲)
A mature pure Java alternative to Cucumber is JBehave
Also Aslak Hellesoy (the creator of Cucumber) promised a native Java version of Cucumber to be released somewhen in 2011 (see his CukeUp keynote)
我比较了 Cucumber、Cucumber-JVM 和 JBehave。它们都是为了编写基于功能(Cucumber、Cucumber-JVM)或故事的验收测试。
Cucumber 的主要缺点是,在纯 Java 环境中通过 Cuke4Duke Maven 插件使用时它很脆弱,因为它需要维护其底层 Ruby (gem) 基础设施。它的速度也相对较慢,并且无法直接调试 - 您需要附加一个远程调试器。
JBehave 是一个非常成熟的、纯 Java 的 Cucumber 替代品。它的输出不像 Cucumber 那样漂亮,但它有很好的文档记录、易于使用且速度快。对 JUnit 有本机支持。
自 2011 年 12 月起,您现在还可以使用 Cucumber 的纯 Java 版本,称为 Cucumber-JVM。它与 JBehave 一样快速且易于使用,并且具有本机 JUnit 支持。不幸的是,它没有任何漂亮的基于 HTML 的结果输出,甚至没有 JBehave 的基本产品,尽管这个问题应该在未来几个月内得到修复。它还缺乏文档。与 JBehave 相比,它的主要优势是支持功能而不是故事。
I compared Cucumber, Cucumber-JVM and JBehave. They are all meant for writing acceptance tests that are based on either features (Cucumber, Cucumber-JVM) or stories.
Cucumber's main disadvantages are that it's brittle when used via the Cuke4Duke Maven plugin in a pure Java environment since it requires maintaining its underlying Ruby (gem) infrastructure. It's also comparably slow and direct debugging isn't possible - you will need to attach a remote debugger instead.
JBehave is a very mature, pure Java alternative to Cucumber. It's output isn't quite as pretty as Cucumber's, but it's well documented, easy to use, and fast. There is native support for JUnit.
As of December 2011, you can now additionally use a pure Java version of Cucumber which is called Cucumber-JVM. It is just as fast and easy to use as JBehave, and it has native JUnit support. Unfortunately, it doesn't have any pretty HTML-based result output, not even the rudimentary offerings of JBehave, though this should be fixed in the coming months. It also lacks documentation. Its main advantage over JBehave is the support of features instead of stories.
查看 cuke4duke。它是 JVM 的 Cucumber,不需要 Ruby。
Check out cuke4duke. It's cucumber for the JVM, no Ruby required.
如果您喜欢用简单的英语编写测试,那么 Twist 是您的最佳选择赌注。底层测试代码将采用 java 语言。
If you like the idea of writing tests in plain english, then Twist is your best bet. Underlying test code will be in java.