I'm using python and Gauge framework. I need to perform some action in @after_scenario only when scenario fails.
I've tried to dig in the framework in search of related property and I found following one:
Scenario.is_failing
After printing it on a console in after_scenario I woud expect true/false, but instead of this I can see:
<property object at 0x000002600477F060>
Could you please explain me why is that and what can I do to get simple true/false?
CodePudding user response:
You need to be looking at the current execution context. Example:
print(context[.specification | .scenario].is_failing)
Python code for getting whether the current specification and current scenario is failing.
@after_scenario
def after_scenario_hook(context):
print(f'Specification is failing: {context.specification.is_failing}')
print(f'Scenario is failing: {context.scenario.is_failing}')
Same, but Java.
@AfterScenario
public void afterGaugeScenario(ExecutionContext context) {
System.out.println("Specification is failing: " context.getCurrentSpecification().getIsFailing());
System.out.println("Scenario is failing: " context.getCurrentScenario().getIsFailing());
}