量angular器configuration文件:cucumberOpts标签不单独采取或忽略

我正在使用下面的configuration文件。

/*EC:201611*/ var featsLocation = 'features/'; var stepsLocation = 'steps/'; exports.config = { params:{ authURL:'http://localhost:3333', login:{ email:'', passw:'' } }, resultJsonOutputFile:'', getPageTimeout: 60000, allScriptsTimeout: 500000, framework: 'custom', frameworkPath: require.resolve('protractor-cucumber-framework'), capabilities: { 'browserName': 'phantomjs', 'phantomjs.binary.path': '/srv/build/applications/phantomjs/bin/phantomjs' }, specs: [ featsLocation+'ediRejects.feature' , featsLocation+'shipmentValidation.feature' ], baseUrl: '', cucumberOpts: { tags: ['@Smoke','@Intgr'], require: [ stepsLocation+'ediRejects/ediRejects.spec.js' , stepsLocation+'shipmentValidation/shipmentValidation.spec.js' , stepsLocation+'appointmentsOverdue/appointmentsOverdue.spec.js' , stepsLocation+'deliveryOverdue/deliveryOverdue.spec.js' , stepsLocation+'cpLogin/cpLogin.spec.js' , stepsLocation+'globalSearch/globalSearch.spec.js' , './support/hooks.js' ], monochrome: true, strict: true, plugin: "json" }, }; /*EC:201611*/ 

正如你可以看到我添加这些标签:['@Smoke','@ Intgr']。 在function文件中,我将标签放在场景的顶部,像这样…

 Feature: EDI-Rejects @Smoke Scenario: Access Final Mile Application Given I get authentication to use EDI Rejects widget at Final Mile Application @Smoke Scenario: Validate title and headers When I am testing EDI Rejects widget on the Werner Final Mile URL Then Check the EDI Rejects widget header name is "EDI Rejects" And Check the EDI Rejects Column Header names are "Customer Name", "Contact Name", "Contact Number", "Reject Reason", "Rejected %", "Shipper Ref #" @Intgr Scenario Outline: Validate Global Search Feature When I am testing Global Search Feature of the Werner Final Mile URL Then Check the "<columnName>" search is Correct Examples: | columnName | | Customer Name | | Contact Name | | Contact No | | Reject Reason | | Shipper Reference Number | 

但是当我执行我得到这个…

0场景0步0m00.000s

我错过了什么吗?

节点版本= v 7.2.0。

量angular器版本= 4.0.10。

npm版本= 3.10.9。

另外我注意到,当我把两个标签放在function文件的相同场景块中时,像这样…

 @Smoke @Intgr Scenario: Access Final Mile Application Given I get authentication to use EDI Rejects widget at Final Mile Application @Smoke @Intgr Scenario: Validate title and headers When I am testing EDI Rejects widget on the Werner Final Mile URL Then Check the EDI Rejects widget header name is "EDI Rejects" And Check the EDI Rejects Column Header names are "Customer Name", "Contact Name", "Contact Number", "Reject Reason", "Rejected %", "Shipper Ref #" @Intgr Scenario Outline: Validate Global Search Feature When I am testing Global Search Feature of the Werner Final Mile URL Then Check the "Customer Name" search is Correct @Smoke Scenario Outline: Validate Communication Methods disabled functionality When I am testing Appointments Overdue widget on the Werner Final Mile URL Then Check the Appointments Overdue widget "Phone" Communication button is disabled if none of the agents segments are selected 

前两种情况是由量angular器选取的,但是第三和第四种被忽略。 这对我不起作用,因为不是所有的场景都是抽烟testing,并不是所有的场景都是集成testing。


UPDATE

我做了@拉姆·帕萨拉build议的。 但现在用Cucumberjs2.0我正面临一个新问题:

我正在使用一个package.json来运行我的脚本与npmtesting命令。

这是曾经工作的“旧”语法:

 protractor ./FM_IntTest_UI_conf.js --cucumberOpts.tags ~@ignore --cucumberOpts.tags @smoke,@rt,@sprint 

基于新的cucumberjs文档说什么…

在老cucumberjs

这个:–cucumberOpts.tags〜@ ignore –cucumberOpts.tags @ smoke,@ rt,@sprint

在cucumberjs2.0

成为:–cucumberOpts.tags'not @ignore和(@smoke或@rt)'

所以我试了一下:

 protractor ./FM_IntTest_UI_conf.js --cucumberOpts.tags 'not @ignore and (@smoke or @rt)' 

为了更加符合cucumberjs2.0 doc,我也试过:

 protractor ./FM_IntTest_UI_conf.js --tags 'not @ignore and (@smoke or @rt)' 

都没有工作。 对于这两个我得到了以下错误:

“这个时候出乎意料。 C:\ workspace>“C:\ workspace \ node_modules.bin \ node.exe”“C:\ workspace \ node_modules.bin \ .. \ protractor \ bin \ protractor”./FM_IntTest_UI_conf.js — tags'not @忽略e和(@smoke或@rt)'

npm ERR! testing失败。 参见上面的更多细节。

什么是现在正确的语法?

更新(20170613)

经过反复试验,我发现了以下所有内容:

语法必须使用像这样的双引号:

 protractor ./FM_IntTest_UI_conf.js --tags "not @ignore and (@smoke or @rt)" 

Cucumberjs文档不正确。

把这个放在package.json中,需要使用转义字符:

 "protractor ./FM_IntTest_UI_conf.js --tags \"not @ignore and (@smoke or @rt)\"" 

几个东西在这里 –

tags cli选项接受一个string而不是数组源代码 。 在小于 2.0的cucumberJS版本中,你可以像这样声明它们来运行@Smoke或者@Intgr场景 –

  cucumberOpts: { tags: '@Smoke,@Intgr' } 

这应该现在解决你的问题。

但是自从Cucumber 2.0开始,这将会改变。 它目前处于RC(发布候选)阶段,很快protractor-cucumber-framework会支持它,很多突破性变化已经被引入,其中之一会影响tagsexpression。 根据他们的官方文档, cucumber-tag-expression引入了更具可读性的新风格标签:

 cucumberOpts: { tags: '@Smoke or @Intgr' } //complex tags would become somewhat like this- cucumberOpts: { tags: '(@Smoke or @Intgr) and (not @Regression)' }