JavaScript BDD:誓言和承诺久里VS。茉莉花

发布于 2024-10-01 07:59:40 字数 269 浏览 1 评论 0原文

我打算选择 VowsKyuri,但后来我发现了Jasmine。你推荐哪一个?誓言还是茉莉花?是否有与 Jasmine 一起使用的 Cucumber 实现?

I was going to go with Vows and Kyuri, but then I found out about Jasmine. Which do you recommend? Vows or Jasmine? Is there a Cucumber implementation that works with Jasmine?

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

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

发布评论

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

评论(3

清音悠歌 2024-10-08 07:59:40

Jasmine

优点:

  • 文档齐全且受支持
  • 内置间谍
  • RSPec-ish DSL
  • 与其他工具的良好集成

缺点:

  • 污染全局命名空间
  • 不是为 NodeJS

Vows

构建的优点:

  • 干净且有意义的语法
  • 为 NodeJS 创建(即异步测试)
  • CoffeeScript(它确实是美丽的)
  • 开箱即用的观察者

缺点:

  • 文档(例如拆卸功能)
  • 批次和数量开始时上下文可能会很奇怪
  • 没有内置间谍(SinonJS ftw)

我更喜欢用 Vows 来测试 NodeJS 应用程序,用 Jasmine 来测试客户端代码。一旦你习惯了 CoffeeScript,誓言就会变得非常干净和强大。

Jasmine

Pros :

  • Well documented and supported
  • Built-in spies
  • RSPec-ish DSL
  • Nice integration with other tools

Cons :

  • Pollutes global namespace
  • Not built for NodeJS

Vows

Pros :

  • Clean and meaningful syntax
  • Created for NodeJS (ie. Asynchronous Testing)
  • CoffeeScript (it is really beautiful with)
  • Watcher out of the box

Cons :

  • Documentation (eg. teardown functions)
  • Batches & Contexts can be odd when beginning
  • No built-in spies (SinonJS ftw)

I would prefer Vows for testing NodeJS applications and Jasmine for client side code. Once you get used to CoffeeScript, vows becomes really clean and powerful.

淡淡绿茶香 2024-10-08 07:59:40

我认为值得注意的是,Kyuri 并没有真正做与 Cucumber 相同的事情。其实只是小黄瓜而已。您可以在顶部实现该功能,但它并不是开箱即用的。

就我个人而言,我正在使用誓言。这有点费脑子,但它相对简单,并且语法更适合我非常喜欢的 CoffeeScript。另外,我真的不想让 Ruby 参与我的构建过程,尽管您的情况可能会有所不同,并且我保留改变想法的权利。

I think it's important to note that Kyuri doesn't really do the same thing as Cucumber. It's actually just the gherkin bit. You could implement the functionality on top, but it's not coming out of the box.

Personally, I'm using vows. It's a bit brain-bending, but it's relatively simple and has a syntax which works better with CoffeeScript, which I'm very fond of. Also, I don't really want to involve Ruby in my build process, although your mileage may vary and I reserve the right to change my mind about that one.

海之角 2024-10-08 07:59:40

我认为jasmine更适合javascript中的单元测试。非常简单且功能强大,非常容易获得它,并且与其他工具(例如 rake 或 Rails)很好地集成。

I think jasmine is more suitable for unit testing in javascript. Is really simple and powerful, quite straightforward to get it and integrates nice with other tools such as rake or rails.

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