我正在尝试将量角器结果导出到xml文件,
我在网上找到了这个很棒的链接: https://github.com/angular/protractor/issues/60
我在网上找到了这个很棒的链接: https://github.com/angular/protractor/issues/60
运行后:npm install jasmine-reporter
require('jasmine-reporters'); jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter( 'C:\temp\test',true,true));
我收到以下错误:
jasmine.console_reporter.js:2
if (! jasmine) {
^
ReferenceError: jasmine is not defined
我附在这里我的配置文件,请告诉我我做错了什么,我该如何解决这个问题:
require('jasmine-reporters'); jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter( 'C:\temp\test',true)); // An example configuration file. exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub',chromeOnly: true,capabilities: { 'browserName': 'chrome' },specs: ['../test/protractor/publisher_list_e2e.js'],allScriptsTimeout: 60000,// Options to be passed to Jasmine-node. jasmineNodeOpts: { showColors: true,defaultTimeoutInterval: 30000 } };
解决方法
您必须更改配置文件,使其如下所示:
// An example configuration file. exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub',// Options to be passed to Jasmine-node. onPrepare: function() { require('jasmine-reporters'); jasmine.getEnv().addReporter( new jasmine.JUnitXmlReporter(null,'<path to directory>') ); },jasmineNodeOpts: { showColors: true,defaultTimeoutInterval: 30000 }
};
整个jasmine-reports功能必须在onPrepare语句中完成,因为jasmine是唯一必须保证在onPrepare函数内的方法.
并将基于项目的根文件夹.如果这有帮助,请告诉我!