如何在空手道或黄瓜报告中获取afterFeature和afterScenario报告 [英] how to get afterFeature and afterScenario report in either karate or cucumber reporting
问题描述
是否有可能将afterFeature和afterScenario中的调用状态作为报告显示在cumber-html-reporting报告和空手道报告(最好同时包含两者)中
Is it possible to see the status of the calls in a afterFeature and afterScenario as a report inside of either cucumber-html-reporting and the karate reports (preferably both)
致谢
推荐答案
可以再次检查.我以为afterScenario
已经被记录了.老实说,仅在极少数情况下才应使用after
挂钩. 但是请随时提出一个功能要求,使 afterFeature
也要出现在日志中.
Can you check again. I thought afterScenario
is already being logged. Honestly you should use the after
hooks only in rare circumstances. But feel free to raise a feature request for the afterFeature
to be present in the logs as well.
实际上,如果使用*.feature
文件实现afterScenario和afterFeature挂钩,实际上只是意识到 -您会看到日志.我刚刚对此(请参阅提交)进行了测试.因此,您必须在挂钩JS中使用karate.call('my-hook-code.feature')
.
Actually just realized that only if you use a *.feature
file to implement your afterScenario and afterFeature hooks - will you see the logs. I just tested this (see commit). So you have to use karate.call('my-hook-code.feature')
in the hook JS.
是的,如果您使用JavaScript打印任何内容或使用karate.log()
,它将不出现在报告中.这是有意的,报告已调整为仅适用于功能步骤.
So yes, if you print anything in JavaScript or use karate.log()
it will not appear in the report. This is intentional, the reporting is tuned to work only for feature steps.
这篇关于如何在空手道或黄瓜报告中获取afterFeature和afterScenario报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!