JasmineNodeOpts - 打印量角器测试结果 [英] JasmineNodeOpts - Printing Protractor Test Results

查看:293
本文介绍了JasmineNodeOpts - 打印量角器测试结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我使用Jasmine作为我的Protractor测试框架,我一直在使用茉莉花规格记者报道。昨天我稍微改变了我的量角器conf.js中的 jasmineNodeOpts 参数,以包含 print()函数,即

Background: I'm using Jasmine as my test framework for Protractor, I've been using jasmine spec reporter for reporting. Yesterday I slightly changed my jasmineNodeOpts parameters in my protractor conf.js to include the print() function i.e.

jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 120000,
    includeStackTrace : true,
    isVerbose : true,
    print: function () {}
},



<我添加了这个打印功能,因为我知道它会在每个报告之前删除。例如,我的测试报告曾经回来:

I added this print function because I learned it would remove the . before each report. For example, my test reports used to come back:

.    ✓ should display a profile question about IT loads
.    ✓ checks the width of the progress bar
.    ✓ selects an option from the radio buttons and updates the progress bar

现在这些前导点已被删除。但是,现在我的最终报告也略有改变:

And now those leading dots are removed. However, now my final report has also slight changed from:

14 specs, 2 failures Finished in 45.473 seconds // this is the old, desired output

对此:

Executed 14 of 14 specs (2 FAILED) in 45 secs. // this is my current, undesired output

我希望两全其美,拥有已从我的报告中删除,但保留了之前的整体报告。

I want the best of both worlds, having the . removed from my report but retaining the previous overall report.

问题:我找不到上的详细文档jasmineNodeOpts 和/或 print()函数。在 jasmine-spec-reporter 量角器参考设置但没有真正的文档关于它是如何工作的,只提供了非常微弱的例子。

Problem: I cannot find detailed documentation on jasmineNodeOpts and/or that print() function. It is mentioned in jasmine-spec-reporter and the protractor reference conf but there is no real documentation on how it works, only very weak examples are provided.

有谁知道我可以在哪里了解更多关于这个 print()函数和/或如何更改我的最终测试输出?

Does anyone know where I can learn more about this print() function and/or how to change my final test output?

推荐答案

我有一个针对此案例的解决方案。这是一种黑客攻击, jasmine-spec-reporter 的小改动 - displaySummary logic

I have one solution for this case. This is kind of a hack, a small change in the jasmine-spec-reporter - displaySummary logic

node_modules / jasmine-spec-reporter / src中替换方法 - 摘要(指标) /spec-display.js 具有以下逻辑

Replace the method - summary(metrics) at node_modules/jasmine-spec-reporter/src/spec-display.js with the below logic

summary: function (metrics) {

    this.log(metrics.executedSpecs + ' specs, ' +  metrics.failedSpecs+ ' failures Finished in ' + metrics.duration);
    if (metrics.random) {
      this.log('Randomized with seed ' + metrics.seed + '.');
    }
  },

我刚检查并生成执行摘要为你期待

I just checked and its generating the execution summary as you are expecting

Spec started

   - sample test
    √ Dummy Test
    √ Dummy Test2
    √ Dummy Test3


3 specs, 0 failures
Finished in 27.544 seconds

  3 specs,0 failures Finished in 28 secs

这篇关于JasmineNodeOpts - 打印量角器测试结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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