gpt4 book ai didi

JasmineNodeOpts - 打印 Protractor 测试结果

转载 作者:行者123 更新时间:2023-12-01 04:52:58 24 4
gpt4 key购买 nike

背景 :我使用 Jasmine 作为 Protractor 的测试框架,我一直使用 jasmine spec reporter 进行报告。昨天我稍微更改了 Protractor conf.js 中的 jasmineNodeOpts 参数以包含 print() 函数,即

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

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

现在那些前导点被删除了。但是,现在我的最终报告也略有变化:
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

我想要两全其美,从我的报告中删除 . 但保留以前的整体报告。

问题 :我找不到有关 jasmineNodeOpts 和/或该 print() 函数的详细文档。它在 jasmine-spec-reporterprotractor reference conf 中提到,但没有关于它如何工作的真正文档,只提供了非常弱的例子。

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

最佳答案

对于这种情况,我有一个解决方案。这是一种 hack,jasmine-spec-reporter - displaySummary 逻辑的一个小改动

summary(metrics) 中的方法 - node_modules/jasmine-spec-reporter/src/spec-display.js 替换为以下逻辑

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 + '.');
}
},

我刚刚检查了它并按照您的期望生成了执行摘要
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 - 打印 Protractor 测试结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39792691/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com