Is there a way to output protractor test results to a file to be viewed outside of the command line after a test is run, including seeing detailed failures?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Just the test output is enough?
protractor conf.js > test.log
Cheers.
回答2:
I found a nice clean way of saving the test results in a orderly fashion using Jasmine reporter.
How to install and configure Jasmine reporter:
Install Jasmine reporter:
npm install -g jasmine-reporters
Add the following to the protractor-config.js file:
onPrepare: function() {
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmineReporters.JUnitXmlReporter('outputxmldir', true, true));
}
Create the outputxmldir folder (This is where all the test outputs will be placed).
Run protractor and now the results will be exported to an XML file in the outputxmldir folder.
回答3:
You can also set the resultJsonOutputFile option in the config file:
export.config = {
(...)
// If set, protractor will save the test output in json format at this path.
// The path is relative to the location of this config.
resultJsonOutputFile:'./result.json',
(...)
}
More details about the config file can be found at:
https://raw.githubusercontent.com/angular/protractor/master/docs/referenceConf.js