有没有一种使用Gherkin DSL进行Javascript测试的BDD框架?

16

我非常喜欢使用BDD和PHP中的Behat。是否有类似于JavaScript的等效工具,即使用Gherkin DSL?到目前为止,我看到的所有工具更像RSpec,如果可能的话,我想更像Cucumber那样接近JS测试。


2
被接受的答案已经不再有效,Kyuri仓库也已过时。正确的答案是Johnno Nolan的:https://github.com/cucumber/cucumber-js - Xolv.io
@Xolv.io 没错。已更新。谢谢! - JoshuaDavid
4个回答

11

6

cucumber.js应该正是您所需要的。虽然还没有完全完成,但值得一看。


4

Yadda 支持 Given / When / Then 风格的语法。它可以插入到其他测试框架中,如 qunit、mocha 或 casperjs,并允许您按照以下方式编写测试...

Scenario: A bottle falls from the wall

    Given 100 green bottles are standing on the wall
    when 1 green bottle accidentally falls
    then there are 99 green bottles standing on the wall

Scenario: No bottles are left

    Given 1 green bottles are standing on the wall
    when 1 green bottle accidentally falls
    then there are 0 green bottles standing on the wall                     


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接