Protractor + AngularJS + Jasmine 获取 xml 文件的输出结果 [英] Protractor + AngularJS + Jasmine get output results on xml file

查看:18
本文介绍了Protractor + AngularJS + Jasmine 获取 xml 文件的输出结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将量角器结果导出到 xml 文件,我在网上找到了这个很棒的链接:https://github.com/angular/protractor/issues/60

运行后:npm install jasmine-reporters

我在我的 protracotr 配置文件中添加了以下几行:

require('jasmine-reporters');jasmine.getEnv().addReporter(新 jasmine.JUnitXmlReporter('C:	emp	est', true, true));

我收到以下错误:

<块引用><块引用><块引用>

jasmine.console_reporter.js:2如果(!茉莉花){^ReferenceError: 茉莉花未定义

我在这里附上了我的配置文件,请告诉我我做错了什么,我该如何解决这个问题:

require('jasmine-reporters');jasmine.getEnv().addReporter(新 jasmine.JUnitXmlReporter('C:	emp	est', true, true));//一个示例配置文件.出口.config = {seleniumAddress: 'http://localhost:4444/wd/hub',chromeOnly:真,能力:{浏览器名称":铬"},规格:['../test/protractor/publisher_list_e2e.js'],allScriptsTimeout: 60000,//传递给 Jasmine-node 的选项.茉莉花节点选择:{显示颜色:真,默认超时间隔:30000}};

解决方案

你必须改变你的配置文件,使它看起来像这样:

//一个示例配置文件.出口.config = {seleniumAddress: 'http://localhost:4444/wd/hub',chromeOnly:真,能力:{浏览器名称":铬"},规格:['../test/protractor/publisher_list_e2e.js'],allScriptsTimeout: 60000,//传递给 Jasmine-node 的选项.onPrepare:函数(){要求('茉莉花记者');jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter(null, true, true, '<目录路径>'));},茉莉花节点选择:{显示颜色:真,默认超时间隔:30000}};

整个 jasmine-reports 功能必须在 onPrepare 语句中完成,因为需要 jasmine 唯一保证的方法是在onPrepare 函数.

并且将基于您项目的根文件夹.

I'm trying to export protractor results to xml files, i found this great link on web: https://github.com/angular/protractor/issues/60

After running : npm install jasmine-reporters

i added the following lines to my protracotr config file:

require('jasmine-reporters');

jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter(
    'C:	emp	est', true, true));

and i get the following error:

jasmine.console_reporter.js:2 if (! jasmine) { ^ ReferenceError: jasmine is not defined

i attached here my config file, please advise what am i doing wrong, and how can i fix this:

require('jasmine-reporters');

jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter(
    'C:	emp	est', true, 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
  }

};

解决方案

You have to change your config file so it looks like this:

// 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.
  onPrepare: function() {      
    require('jasmine-reporters');
    jasmine.getEnv().addReporter(
      new jasmine.JUnitXmlReporter(null, true, true, '<path to directory>')
    );
  },

  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000
  }
};

The whole jasmine-reports feature has to be done in the onPrepare statement since jasmine is required the only way that's guaranteed is within the onPrepare function.

And will be based from the root folder of your project.

这篇关于Protractor + AngularJS + Jasmine 获取 xml 文件的输出结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆