Protractor cucumber量角器未使用多个标记运行

Protractor cucumber量角器未使用多个标记运行,protractor,cucumber,cucumberjs,Protractor,Cucumber,Cucumberjs,我有几个场景标记为@test和@high。当我使用以下语法的单个标记运行时,它工作得很好 package.json "smoke": "babel-node node_modules/protractor/bin/protractor protractorConf.js --presets-env --cucumberOpts.tags \"@smoke\"", "high": "babel-node node_modules/protractor/bin/protractor protrac

我有几个场景标记为@test和@high。当我使用以下语法的单个标记运行时,它工作得很好

package.json

"smoke": "babel-node node_modules/protractor/bin/protractor protractorConf.js --presets-env --cucumberOpts.tags \"@smoke\"",
"high": "babel-node node_modules/protractor/bin/protractor protractorConf.js --presets-env --cucumberOpts.tags \"@test,@high\""
但当我运行这个程序时,要运行同时带有@test和@high标记的场景,什么都不会发生,只调用了0个场景

package.json

"smoke": "babel-node node_modules/protractor/bin/protractor protractorConf.js --presets-env --cucumberOpts.tags \"@smoke\"",
"high": "babel-node node_modules/protractor/bin/protractor protractorConf.js --presets-env --cucumberOpts.tags \"@test,@high\""
我尝试了许多选项,如下面,但没有任何效果

--cucumberOpts.tags "@test" --cucumberOpts.tags "@high"
--cucumberOpts.tags @test --cucumberOpts.tags @high
--cucumberOpts.tags "(@test and @high)"
--cucumberOpts.tags "@test and @high"
请帮助我了解如何运行多个AND或场景。下面是我的软件包版本

"cucumber": "^4.2.1",
"protractor": "^5.3.2",
"protractor-cucumber-framework": "^5.0.0"
下面是我调用命令时的实际输出

c:\Personal\ATDD  (protractortest@1.0.0)
λ npm run high

> protractortest@1.0.0 high c:\Personal\ATDD
> babel-node node_modules/protractor/bin/protractor protractorConf.js --presets-env --cucumberOpts.tags "@test,@high"

(node:8100) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[11:48:21] I/launcher - Running 1 instances of WebDriver
[11:48:21] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
(node:8100) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.


0 scenarios
0 steps
0m00.000s
Cucumber HTML report c:\Personal\ATDD\reports\html/cucumber_reporter.html generated successfully.
[11:48:25] I/launcher - 0 instance(s) of WebDriver still running
[11:48:25] I/launcher - chrome #01 passed

我在这里发现了问题。实际上,我误解了@test和@high将调用任何一个标记的场景。我现在知道它将调用一个场景,该场景已标记为@test和@high,如下所示

@smoke @test @high
Scenario: ...
Given ... 
When ...
Then ...
而且不像

@smoke @test
Scenario: ...
Given ... 
When ...
Then ...

@smoke @high
Scenario: ...
Given ... 
When ...
Then ...

我在这里发现了问题。实际上,我误解了@test和@high将调用任何一个标记的场景。我现在知道它将调用一个场景,该场景已标记为@test和@high,如下所示

@smoke @test @high
Scenario: ...
Given ... 
When ...
Then ...
而且不像

@smoke @test
Scenario: ...
Given ... 
When ...
Then ...

@smoke @high
Scenario: ...
Given ... 
When ...
Then ...

回答

为了解释发生了什么,您希望运行指定的两个标记,即使场景中没有两个标记

为此,在标记表达式中需要
关键字

“@test或@high”
就是您要找的

有关标记表达式的详细信息

要运行单个标记,请执行以下操作:

  • -cucumberOpts.tags“@tag1”
    -运行带有@tag1标记的场景
  • -cucumberOpts.tags“not@tag1”
    -运行未标记@tag1的场景
如果要运行多个标记,或指定不运行的标记:

  • -cucumberOpts.tags“@tag1或@tag2”
    -运行使用
    @tag1
    @tag2
    或两者标记的场景
  • -cucumberOpts.tags“@tag1和@tag2”
    -运行带有
    @tag1
    @tag2
    标记的场景
  • -cucumberOpts.tags“@tag1而非@tag2”
    -运行使用
    @tag1
    标记但未使用@tag2标记的场景
对于更复杂的标记表达式,为了清晰起见,可以使用括号,或更改运算符优先级:

  • -cucumberOpts.tags“@tag1和not(@tag2或@tag3)”
    -在没有标记@tag2或@tag3的情况下,运行标记为tag1的场景
  • -cucumberOpts.tags”(非@tag1)和(@tag2或@tag3)
    -运行未标记为
    @tag1
    但标记为
    @tag2
    @tag3
    的场景

  • 回答

    为了解释发生了什么,您希望运行指定的两个标记,即使场景中没有两个标记

    为此,在标记表达式中需要
    关键字

    “@test或@high”
    就是您要找的

    有关标记表达式的详细信息

    要运行单个标记,请执行以下操作:

    • -cucumberOpts.tags“@tag1”
      -运行带有@tag1标记的场景
    • -cucumberOpts.tags“not@tag1”
      -运行未标记@tag1的场景
    如果要运行多个标记,或指定不运行的标记:

    • -cucumberOpts.tags“@tag1或@tag2”
      -运行使用
      @tag1
      @tag2
      或两者标记的场景
    • -cucumberOpts.tags“@tag1和@tag2”
      -运行带有
      @tag1
      @tag2
      标记的场景
    • -cucumberOpts.tags“@tag1而非@tag2”
      -运行使用
      @tag1
      标记但未使用@tag2标记的场景
    对于更复杂的标记表达式,为了清晰起见,可以使用括号,或更改运算符优先级:

    • -cucumberOpts.tags“@tag1和not(@tag2或@tag3)”
      -在没有标记@tag2或@tag3的情况下,运行标记为tag1的场景
    • -cucumberOpts.tags”(非@tag1)和(@tag2或@tag3)
      -运行未标记为
      @tag1
      但标记为
      @tag2
      @tag3
      的场景