如何保存量角器测试结果

时间:2022-01-10 01:23:39

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?

有没有办法在运行测试后将量角器测试结果输出到要在命令行之外查看的文件,包括查看详细的故障?

3 个解决方案

#1


7  

I found a nice clean way of saving the test results in a orderly fashion using Jasmine reporter.

我找到了一个很好的清洁方式,使用Jasmine记者以有序的方式保存测试结果。

How to install and configure Jasmine reporter:

如何安装和配置Jasmine记者:

Install Jasmine reporter:

安装Jasmine记者:

npm install -g jasmine-reporters

Add the following to the protractor-config.js file:

将以下内容添加到protractor-config.js文件中:

  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).

创建outputxmldir文件夹(这是放置所有测试输出的位置)。

Run protractor and now the results will be exported to an XML file in the outputxmldir folder.

运行量角器,现在结果将导出到outputxmldir文件夹中的XML文件。

#2


6  

Just the test output is enough?

只是测试输出就足够了?

protractor conf.js > test.log

Cheers.

干杯。

#3


4  

You can also set the resultJsonOutputFile option in the config file:

您还可以在配置文件中设置resultJsonOutputFile选项:

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

https://raw.githubusercontent.com/angular/protractor/master/docs/referenceConf.js

#1


7  

I found a nice clean way of saving the test results in a orderly fashion using Jasmine reporter.

我找到了一个很好的清洁方式,使用Jasmine记者以有序的方式保存测试结果。

How to install and configure Jasmine reporter:

如何安装和配置Jasmine记者:

Install Jasmine reporter:

安装Jasmine记者:

npm install -g jasmine-reporters

Add the following to the protractor-config.js file:

将以下内容添加到protractor-config.js文件中:

  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).

创建outputxmldir文件夹(这是放置所有测试输出的位置)。

Run protractor and now the results will be exported to an XML file in the outputxmldir folder.

运行量角器,现在结果将导出到outputxmldir文件夹中的XML文件。

#2


6  

Just the test output is enough?

只是测试输出就足够了?

protractor conf.js > test.log

Cheers.

干杯。

#3


4  

You can also set the resultJsonOutputFile option in the config file:

您还可以在配置文件中设置resultJsonOutputFile选项:

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

https://raw.githubusercontent.com/angular/protractor/master/docs/referenceConf.js