Tags Protractor + Jasmine to run set of suites

时光总嘲笑我的痴心妄想 提交于 2019-12-09 16:50:18

问题


I'm trying to figure out a way to use in the same way, or better said, similar way, the tagging options that cucumberJS has with protractor, but with Jasmine, is there a way to tag the different scenarios, like: @smoke, @regression, etc.. and then tell on console to run with those?

I'm declining to use Cucumber, since it's support it's seems to be getting flaky!

Any help will be much appreciated!


回答1:


With jasmine2 you can filter tests using a regular expression. Maybe you can add something like @smoke, @regressions to your tests and then only run those ones by passing the grep flag:

it('should do stuff @smoke', function() {
  ...
});

Then run protractor passing the grep flag:

protractor conf.js --grep='@smoke'




回答2:


Alternative to grep would to be to use suites:

suites: {
    smoke: [ 
        "spec1.js",
        "spec2.js",
        "spec3.js"
    ],

    regression: [
        "spec4.js",
        "spec5.js",
    ],
}

Then, run protractor specifying the suite argument:

protractor conf.js --suite smoke
protractor conf.js --suite regression
protractor conf.js --suite smoke,regression


来源:https://stackoverflow.com/questions/34004522/tags-protractor-jasmine-to-run-set-of-suites

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