Node.js 的 BDD 和 TDD?
Node.js 的 BDD 和 TDD 有何用途?
我习惯使用 Cucumber + RSpec。对于 Node.js 来说,什么是好的组合?
谢谢
What is used for BDD and TDD with node.js?
I'm used to use Cucumber + RSpec. What's a good combo for node.js?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
更新
Mocha 现在得到我的投票!
您可以查看node.js 中的测试模块部分模块页面。例如,Vows 是一个非常流行的 BDD 框架。
Update
Mocha gets my vote now!
You could have a look at the testing modules section from the node.js modules page. For example Vows is a pretty popular BDD framework.
查看 摩卡 - (github)
还有摩卡蛋糕,我对黄瓜的尝试摩卡语法。
Check out mocha - (github)
Also mocha-cakes, my attempt for Cucumber syntax on mocha.
如果您习惯了 rspec,Jasmine 非常不错。我没有在 Node.js 上使用过它,但我用它来测试主干应用程序。它的语法与 rspec 非常相似。取自上面的网站:
它列在上面 Alfred 提供的链接中,但由于人们列出了 Vows 作为示例,我想我应该给 Jasmine 一个提升,特别是因为它在语法上与 rspec 相似;)
If you are used to rspec, Jasmine is pretty nice. I've not used it on Node.js, but I have used it for testing a backbone app. It's syntax is very similar to rspec. Taken from the site above:
It's listed in the link provided by Alfred above, but since folks listed Vows as an example, I figured I'd give Jasmine a bump, especially since it's syntactically similar to rspec ;)
Node 上有 BDD 的“Vows”项目 http://vowsjs.org,看起来相当不错。和 RSpec/Cucumber 有点不同,但是很有趣
There is the 'Vows' project for BDD on Node http://vowsjs.org, looks pretty nice. It's a bit different from RSpec/Cucumber, but it's pretty fun
也许稍后,但您要寻找的是 Kyuri: https://github.com/nodejitsu/kyuri< /a>
“kyuri 是一个带有一些额外异步关键字的 Node.js Cucumber 实现。它支持 160 多种语言并导出到 VowsJS 存根”
此外,nodejitsu 似乎还构建了一个 Web 应用程序,用于管理协作项目中的 Kyuri 功能规范顺便说一句,它的名字叫“婚前协议”,我想看看。
Maybe a little later, but what you're looking for is Kyuri: https://github.com/nodejitsu/kyuri
"kyuri is a node.js Cucumber implementation with a few extra asynchronous keywords. it supports 160+ languages and exports to VowsJS stubs"
Also, nodejitsu seems to have built a web app for managing a project Kyuri feature specs in a collaborative way, it's named "prenup", I would give it a look.
您也可以尝试 yadda。它可以插入其他测试库,包括 mocha、jasmine、casper 和webdriver,而且还允许您编写适当的功能文件,而不仅仅是在现场注释您的测试。典型的测试可能看起来像...
以及功能文件...
以及输出...
You could also try yadda. It plugs into other test libraries including mocha, jasmine, casper & webdriver, but also lets you write proper feature files instead of merely annotating you tests in situ. A typical test might look like...
And the feature file...
And output...
查看 Buster.JS。由 Christian Johansen 创建,他确实写了关于 javascript 测试的书。
Buster 支持 TDD 和 BDD。它通过浏览器自动化(想想 JsTestDriver)、QUnit 风格的静态 HTML 页面测试、无头浏览器(PhantomJS、jsdom)等进行浏览器测试。
Check out Buster.JS. Created by Christian Johansen, who literally wrote the book on javascript testing.
Buster supports both TDD and BDD. It does browser testing with browser automation (think JsTestDriver), QUnit style static HTML page testing, testing in headless browsers (PhantomJS, jsdom), and more.
套餐a
(bdd 和嘲笑)
https://npmjs.org/package/a
语法非常紧凑,上下文与行为分离,可链接行为。
递归搜索的 Easy Cmd 行运行器。
Package a
(bdd and mocking)
https://npmjs.org/package/a
Very compact syntax, context separated from acts, chainable acts.
Easy Cmd line runner that searches recursively.
单元测试:Mocha 非常适合单元测试。
BDD 测试 如果您想要 Node.js 的 BDD 测试框架,那么我推荐 Cucumber 包。
Unit tests: Mocha is great for unit tests.
BDD tests If you want a BDD test framework for Node.js then I'd recommend the Cucumber package.
上个月我也经历过同样的担忧。
对于 BDD :
虽然 Mocha 本身通过描述和 it 语句提供了 BDD 风格。
对于像黄瓜这样的风格,你可以尝试:
他们都有自己的风格。很抱歉,我现在无法提供工作片段,请告诉我 @Donald 您选择了哪一个。想知道您的见解。
I was going through the same concern last month .
For BDD :
Though Mocha itself provides BDD style by their describe and it statements.
For styles like cucumber , you can try :
They all have their own styles. I am sorry I can not provide working snippets now , let me know @Donald which one you select. Would like to know your insight.
我也在寻找一个好的 Gherkin 实现,发现 mocha-cakes/mocha-cakes-2 很好,但功能不是很全。所以我以 mocha 为基础构建了自己的语言,它与包括 Scenario Outlines 在内的 Gherkin 语言具有同等性。它还可以轻松地在测试中引用数据。它与 cucumber.js 不同,因为它都是内联文件而不是单独的文件。您可以在这里找到该项目:
livedoc-mocha
I too was looking for a good Gherkin implementation, found mocha-cakes/mocha-cakes-2 which were nice but not very full featured. So I build my own with mocha as the base, which has parity with the gherkin language including Scenario Outlines. It also makes it easy to reference the data in your test. Its different to cucumber.js as its all inline not separate files. You can find the project here:
livedoc-mocha