Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param status: scenario status (passed, failed or skipped)
"""
if status == 'skipped':
return
elif status == 'passed':
test_status = 'Pass'
test_comment = None
context_or_world.logger.info("The scenario '%s' has passed", scenario.name)
else:
test_status = 'Fail'
test_comment = "The scenario '%s' has failed" % scenario.name
context_or_world.logger.error("The scenario '%s' has failed", scenario.name)
context_or_world.global_status['test_passed'] = False
# Close drivers
DriverWrappersPool.close_drivers(scope='function', test_name=scenario.name, test_passed=status == 'passed',
context=context_or_world)
# Save test status to be updated later
add_jira_status(get_jira_key_from_scenario(scenario), test_status, test_comment)
def bdd_common_after_all(context_or_world):
"""Common after all method in behave or lettuce
:param context_or_world: behave context or lettuce world
"""
# Close drivers
DriverWrappersPool.close_drivers(scope='session', test_name='multiple_tests',
test_passed=context_or_world.global_status['test_passed'])
# Update tests status in Jira
change_all_jira_status()
def after_feature(context, feature):
"""Clean method that will be executed after each feature
:param context: behave context
:param feature: running feature
"""
# Behave dynamic environment
context.dyn_env.execute_after_feature_steps(context)
# Close drivers
DriverWrappersPool.close_drivers(scope='module', test_name=feature.name,
test_passed=context.global_status['test_passed'])
# Behave dynamic environment: Fail all steps if dyn_env has got any error and reset it
if context.dyn_env.check_error_status_and_reset():
feature.reset()
for scenario in feature.walk_scenarios():
context.dyn_env.fail_first_step_precondition_exception(scenario)