使用黄瓜报告器和量角器-黄瓜框架

时间:2020-01-12 23:39:06

标签: protractor cucumber teamcity

据我了解,protractor-cucumber-framework通过cucumberOpts对象传递给黄瓜,这使用户可以指定诸如stricttags之类的黄瓜选项。我正在尝试在此框架中使用TeamCity记者。根据报告者的说明(例如TeamCity Reporter,要使用此报告者,请在运行黄瓜时使用--format选项指定报告者。因此,我的解释是我应该指定{{1} format对象中的}属性,即cucumberOpts变为:

cucumber -f TeamCityFormatter::Formatter

但是当我这样做时,我得到了错误:

cucumberOpts: {
  'format': 'TeamCityFormatter::Formatter'
}

我想也许我只需要指定模块的名称,所以我尝试了:

Unhandled rejection Error: ENOENT: no such file or directory, open 'C:\Dev\fork\Billing.Test.Automation.V2\:Formatter':

哪个给我这个错误:

cucumberOpts: {
  'format': 'TeamCityFormatter'
}

看起来它正在寻找一个模块,所以我尝试将其指向Unhandled rejection Error: Cannot find module 'C:\Dev\fork\Billing.Test.Automation.V2\TeamCityFormatter' 文件夹中的模块:

node_modules

我收到此错误:

cucumberOpts: {
  'format': 'node_modules/teamcity-formatter'
}

是否有通过Unhandled rejection TypeError: this.registerHandler is not a function 使用黄瓜报告器的特殊方法?

1 个答案:

答案 0 :(得分:0)

不是答案,而是一个如何将软件包作为插件导入的示例

onPrepare:fucntion(){
  ...
},
// Here the magic happens
plugins: [{
    package: 'protractor-multiple-cucumber-html-reporter-plugin',
    options: {
        automaticallyGenerateReport: true,
        removeExistingJsonReportFile: true,
        displayDuration: true
    }
}],