Cucumber-js: @ignore on Scenario 仍然执行它

创建于 2015-02-06  ·  29评论  ·  资料来源: cucumber/cucumber-js

Scenario @ignore上添加Scenario ,但仍会执行它。

最有用的评论

您需要告诉 Cucumber 根据您的标签忽略场景,它不知道您的@ignore标签的含义。

未测试:

cucumberOpts: {
  require: 'cucumber/features/steps/*_steps.js',
  format: 'pretty',
  tags: '~<strong i="8">@ignore</strong>'
}

有关更多信息,请参阅cucumber.js --help

所有29条评论

@D0rmouse在用@ignore标记场景后如何调用黄瓜.js

它使用 grunt-protractor-runner 集成到我的 Grunt 构建中,它读取了一个 Cucumber.conf.js。

对不起,我说得不够清楚。 您将哪些选项传递给 Cucumber?

cucumberOpts: {
    require: 'cucumber/features/steps/*_steps.js',
    format: 'pretty'
  }

您需要告诉 Cucumber 根据您的标签忽略场景,它不知道您的@ignore标签的含义。

未测试:

cucumberOpts: {
  require: 'cucumber/features/steps/*_steps.js',
  format: 'pretty',
  tags: '~<strong i="8">@ignore</strong>'
}

有关更多信息,请参阅cucumber.js --help

好的,谢谢。 我在自述文件中阅读它的方式,它似乎应该是开箱即用的......

哈,README 的哪一部分?

OMG哈哈,我傻了。 那将是https://github.com/cucumber/cucumber/wiki/Tags :(
我猜打开了太多标签。 抱歉打扰你了...

不用担心!

--tags选项对我不起作用

    cucumber() {
        return gulp.src("*.js", { read: false })
            .pipe(shell("cucumber.js -r ./build/es5/test/cucumber/steps/CommonStepDefinitions.js --tags ~<strong i="7">@skip</strong> test/cucumber/features"));
    }

还使用了-t ~@skip快捷方式,

黄瓜的版本:“0.10.2”

@hbakhtiyor你能解释一下它为什么不适合你吗? 你期待什么,会发生什么?

只是没有跳过我标记为@skip的场景

还通过终端尝试了命令,但没有成功

bash# cucumber.js -r ./build/es5/test/cucumber/steps/CommonStepDefinitions.js --tags ~<strong i="8">@skip</strong> test/cucumber/features

例如 entity.feature

Feature: [GET /entities] Get list of entities
  # for success
  <strong i="6">@skip</strong>
  Scenario: Request for all published entities
    Given collection of entities from entity/entities.json data file
    And request "filter" query param's property "published" set to true
    When I request GET /entities
    Then the response status code is 200
    And the response type is JSON
    And the response matches entity/all-entities-published-only.json

@hbakhtiyor你的黄瓜版本是什么?

黄瓜的版本:“0.10.2”

在使用0.9.2版本之前, --tags选项在该版本中不起作用并且使用了0.10.2的最新版本,也不起作用

在 0.10 中,标签界面更改为。 您使用的是新界面吗?

我只在.feature文件上使用标签

嗯,这很奇怪。 我们似乎没有任何关于否定标签的功能测试案例,但我们在自己的测试中使用了否定标签。 --tags @skip对你有用吗? (只运行你会跳过的场景)

相反也不起作用

@charlierudolph我很确定我们曾经有过测试标签排除的场景。 当我们整合测试套件时,那一定已经丢失了。 我刚加了一个。

@hbakhtiyor我无法重现该问题。 你能和我们分享一些代码吗?

np,但为什么它取决于代码(步骤定义,钩子,..)?

@hbakhtiyor我的意思是分享一些无法按预期工作的

~ @skip方法不起作用 - 至少在 MacOS 上是这样。

我在 ubuntu 16 上使用[email protected]遇到cucumberjs --tags ~@smth同样的问题:当我运行--tags @smth工作正常。

“不工作”是指标签与@smth不同的场景不执行。

为什么问题被关闭? 你@jbpros能进一步调查吗?

为什么问题被关闭?

@likerRr此问题已关闭,因为@jbpro 2 年前提供的解释对于关闭此问题的@D0rmouse来说已经足够了。

如果您遇到问题,请创建新票证。

对不起,好的

由于关闭后没有任何近期活动,因此该线程已自动锁定。 请为相关错误打开一个新问题。

此页面是否有帮助?
0 / 5 - 0 等级