据我所知,protractor-cucumber-framework
通过cucumberOpts
对象传递给黄瓜,这使用户可以指定黄瓜选项,例如strict
和tags
。我正在尝试在此框架中使用TeamCity记者。根据报告者的说明(例如TeamCity Reporter,要使用此报告者,请在运行黄瓜时使用--format
选项指定报告者。因此,我的解释是,我应在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
是否有通过protractor-cucumber-framework
使用黄瓜报告器的特殊方法?
不是答案,而是如何将软件包作为插件导入的示例
onPrepare:fucntion(){
...
},
// Here the magic happens
plugins: [{
package: 'protractor-multiple-cucumber-html-reporter-plugin',
options: {
automaticallyGenerateReport: true,
removeExistingJsonReportFile: true,
displayDuration: true
}
}],