空手道 - 使用执行挂钩禁用挂钩用于称为功能的挂钩
我正在空手道中使用执行挂钩接口进行自定义报告,在这里,我在情况下使用称为功能。 由于我的场景包含称为功能,因此在运行它时将第二次beforescenario零件,因此是否有任何方法可以禁用挂钩以获取所谓的功能。
因为称为功能是我的场景中的一步,所以我们如何作为单独的场景条件制作。
公共类CustomHook实现executionhook {
@Override
public boolean beforeScenario(Scenario scenario, ScenarioContext context) {
boolean skip =false;
String currentTestcase=scenario.getName();
System.out.println(currentTestcase);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是空手道的旧版本,不再受支持。许多团队都遵循了迁移指南,并处于领先地位:
您可以通过调用
sceparioruntime.caller.caller.caller.depth
or 或<代码> specarioruntime.caller.isnone()This is an old version of Karate which is no longer supported. Many teams have followed the migration guide and are far ahead: https://github.com/karatelabs/karate/wiki/1.0-upgrade-guide#hooks
And you can easily check if this is the root scenario or not by calling
ScenarioRuntime.caller.depth
orScenarioRuntime.caller.isNone()