How to run only one feature file when running protractor with cucumber?

本小妞迷上赌 提交于 2019-12-12 12:16:30

问题


I have multiple feature files and I would really love to run just one file or just one scenario or just one tag. I know I could just provide one file in my specs in my cucumberConf.js, but I would like to run it once without fiddling with my cucumberConf.js. Which arguments do I need to type in when running protractor?


回答1:


The easiest way to do this would be to use the --specs option.

protractor --specs=specs/testA.js e2e-conf.js




回答2:


in protractor's config:

cucumberOpts: {
...
        tags: [
        "@runThis",
        "@runThat",
        "~@ignoreThis"
    ];
...
},

in the feature file

    @runThis
    Scenario: Run this Scenario
        Given user does some action
        Then something should happen

    @ignoreThis
    Scenario: ignore this Scenario
        Given user does some action
        Then something should happen



回答3:


use the specs array in protractor config file. E.g.

specs: [ 'test/features/xxx.feature' ],


来源:https://stackoverflow.com/questions/25058977/how-to-run-only-one-feature-file-when-running-protractor-with-cucumber

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!