How can I save protractor test results

ぃ、小莉子 提交于 2019-12-29 06:18:28

问题


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:


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




回答3:


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.



来源:https://stackoverflow.com/questions/23634629/how-can-i-save-protractor-test-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!