我正在使用一个名为“cucumber-boilerplate”的框架,您可以在其中找到它 github:cucumber-boilerplate
如果你按照链接,在'test'文件夹中有一个conf.js文件,我的看起来是这样的:
exports.config = {
/**
* language of your feature files
* options: french, spanish, norwegian, polish, german, russian
*/
language: 'english',
/**
* set selenium host and port
*/
selenium: {
host: '127.0.0.1',
port: 5555
},
/**
* webdriverio options
*
* - logLevel: stdout log level
* Options: *verbose* | *silent* | *command* | *data* | *result*
*
* - coloredLogs: Enables colors for log output
* default: true
*
* - singleton: Set to true if you always want to reuse the same remote
* default: false
*
* - waitforTimeout: Default timeout for all waitForXXX commands
* default: 500
*/
options: {
logLevel: 'verbose',
cucumberOpts: {
failFast:true,
require: [], // <string[]> (file/dir) require files before executing features
backtrace: false, // <boolean> show full backtrace for errors
compiler: [], // <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
dryRun: false, // <boolean> invoke formatters without executing steps
failFast: false, // <boolean> abort the run on first failure
format: ['json:../result.json','pretty','html'], // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
colors: false, // <boolean> disable colors in formatter output
snippets: true, // <boolean> hide step definition snippets for pending steps
source: true, // <boolean> hide source uris
profile: [], // <string[]> (name) specify the profile to use
require: [], // <string[]> (file/dir) require files before executing features
strict: true, // <boolean> fail if there are any undefined or pending steps
tags: [], // <string[]> (expression) only execute the features or scenarios with tags matching the expression
timeout: 20000, // <number> timeout for step definitions
ignoreUndefinedDefinitions: false // <boolean> Enable this config to treat undefined definitions as warnings.
}
},
/**
* desired capabilities
*/
capabilities: {
browserName: 'firefox'
},
reporters: ['dot', 'allure'],
/**
* location of feature files
*/
featureFiles: [
'test/features/automation/Registration/Registration.feature'
],
/**
* environment variables
*
* - baseUrl: sets base url for `Given I open the site "/some/url.html"`
*/
env: {
baseUrl: '<my site URL>'
},
/**
* mocha options
* @see http://mochajs.org/
*/
mochaOpts: {
reporter: 'spec',
timeout: 25000,
require: 'chai'
}
};
我的run.js文件运行并激活正确的功能,但'cucumberOpts'都没有生效,尤其是报告格式和颜色。
你的帮助很受关注:)