Jasmine 茉莉花-打印量角器试验结果
背景:我使用Jasmine作为量角器的测试框架,我一直在使用它进行报告。昨天,我稍微更改了量角器conf.js中的Jasmine 茉莉花-打印量角器试验结果,jasmine,protractor,Jasmine,Protractor,背景:我使用Jasmine作为量角器的测试框架,我一直在使用它进行报告。昨天,我稍微更改了量角器conf.js中的jasmineNodeOpts参数,以包括print()函数,即 jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 120000, includeStackTrace : true, isVerbose : true, print: function () {} }, 我
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 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
太棒了,谢谢你。工作得很好。我不知道为什么我没有想到自己编辑这个报告程序,我被困在如何配置print()
函数:)