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?

有帮助吗?

解决方案

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.

其他提示

Just the test output is enough?

protractor conf.js > test.log

Cheers.

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top