如何使用OR和多个标签运行Cucumber

问题描述 投票:2回答:1

我有黄瓜情景和例子。示例分为使用多个标记,如下所示:

Feature: ...
  Scenario Outline: ...
    ...    
    @Admin @INT
      Examples:
      ...    
    @Admin @EXT
      Examples:
      ...
    @User @EXT
      Examples:
      ...
    @User @INT
      Examples:
      ...

要使用标签@Admin@EXT运行方案

...tags = {"@Admin","@EXT"}...

如何运行方案

{"@Admin","@EXT"} && {"@User","@INT"}{"@Admin","@EXT"} || {"@User","@INT"}

cucumber cucumber-jvm
1个回答
6
投票

这个变化被引入了cucumber-jvm 2.0.0(2017-08-29)

支持Tag Expressions(#1035BjörnRasmusson的一部分)

Migrating from old style tags
--tags @dev stays the same
--tags ~@dev becomes --tags 'not @dev'
--tags @foo,@bar becomes --tags '@foo or @bar'
--tags @foo --tags @bar becomes --tags '@foo and bar'
--tags ~@foo --tags @bar,@zap becomes --tags 'not @foo and (@bar or @zap)'

所以也许是这样的:

-Dcucumber.options="--tags '(@Admin and @EXT) or (@User and @INT)'"

编辑

对于@CucumberOptions,上面的内容如下所示:

tags = {"@tag"}没有变化

tags = {"~tag"}成为tags = {"not tag"}

tags = {"@tag1,@tag2")成为tags = {"@tag1 or @tag2"}

tags = {"@tag1","@tag2"}成为tags = {"@tag1 and @tag2"}

tags = {"@tag1","@tag2,@tag3"}成为tags = {"@tag1 and (@tag2 or @tag3)"}

© www.soinside.com 2019 - 2024. All rights reserved.