0

I have a question Gauge automation framework.

I am trying to get the status of the Scenario i.e., Passed or Failed in the afterScenario hook and store it using DataStore, any idea how to get that?

I use my framework in Python, but any programming language will do.

Sam
  • 375
  • 1
  • 2
  • 13

1 Answers1

1

@Sam You could check the current scenario status in AfterScenario hook using the ExecutionContext store status of that scenario in SpecDataStore and then access that in the BeforeScenario hook of later scenario. The scenario and hooks could be tagged so specific hook runs only for specific scenarios.

Example:

@AfterScenario("tag_for_scenario1")
def store_status(context):
    datastore.spec["scenario_1_passed"] = context.scenario.is_failing


@BeforeScenario("tag_for_scenario2")
def check_status():
  if not datastore.spec["scenario_1_passed"]:
     raise Exception("prerequisite scenario failed")
bugdiver
  • 26
  • 2