'Karate - Disable hook for called feature using execution Hook
I am using Execution hook interface in karate for customised report, here i am using called feature in my scenario. Since my scenario contain called feature, while running it is coming to BeforeScenario Part for second time , is there any way to disable hooks for called feature.
Because called feature is one step in my scenario , how can we make as separate scenario condition.
public class CustomHook implements ExecutionHook {
@Override
public boolean beforeScenario(Scenario scenario, ScenarioContext context) {
boolean skip =false;
String currentTestcase=scenario.getName();
System.out.println(currentTestcase);
Solution 1:[1]
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 or ScenarioRuntime.caller.isNone()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Peter Thomas |
