def _execute_before_step_hook(request, response, _socket): MessagesStore.clear() execution_info = create_execution_context_from( request.stepExecutionStartingRequest.currentExecutionInfo) tags = list(execution_info.scenario.tags) + list( execution_info.specification.tags) run_hook(request, response, registry.before_step(tags), execution_info)
def test_create_execution_context_from(self): message = Message() spec_name = 'SPEC_NAME' spec_file_name = 'SPEC_FILE_NAME' scenario_name = 'SCENARIO_NAME' step_name = 'STEP_NAME' message.executionStartingRequest.\ currentExecutionInfo.currentSpec.name = spec_name message.executionStartingRequest.\ currentExecutionInfo.currentSpec.fileName = spec_file_name message.executionStartingRequest.\ currentExecutionInfo.currentSpec.isFailed = True message.executionStartingRequest.\ currentExecutionInfo.currentScenario.name = scenario_name message.executionStartingRequest.\ currentExecutionInfo.currentScenario.isFailed = False message.executionStartingRequest.\ currentExecutionInfo.currentStep.step.actualStepText = step_name message.executionStartingRequest.\ currentExecutionInfo.currentStep.isFailed = True specification = Specification(spec_name, spec_file_name, True, []) scenario = Scenario(scenario_name, False, []) step = Step(step_name, True) context = ExecutionContext(specification, scenario, step) expected_execution_context = create_execution_context_from( message.executionStartingRequest.currentExecutionInfo) self.assertEqual(expected_execution_context, context)
def _execute_after_step_hook(request, response, _socket): execution_info = create_execution_context_from( request.stepExecutionEndingRequest.currentExecutionInfo) tags = list(execution_info.scenario.tags) + list( execution_info.specification.tags) run_hook(request, response, registry.after_step(tags), execution_info) response.executionStatusResponse.executionResult.message.extend( MessagesStore.pending_messages())
def process_spec_execution_starting_request(request): execution_info = create_execution_context_from( request.currentExecutionInfo) response = run_hook( request, registry.before_spec(execution_info.specification.tags), execution_info) _add_message_and_screenshots(response) return response
def process_step_execution_ending_request(request): execution_info = create_execution_context_from( request.currentExecutionInfo) tags = list(execution_info.scenario.tags) + \ list(execution_info.specification.tags) response = run_hook(request, registry.after_step(tags), execution_info) _add_message_and_screenshots(response) return response
def _execute_after_suite_hook(request, response, _socket): execution_info = create_execution_context_from( request.executionEndingRequest.currentExecutionInfo) run_hook(request, response, registry.after_suite(), execution_info) response.executionStatusResponse.executionResult.message.extend( MessagesStore.pending_messages()) response.executionStatusResponse.executionResult.screenshots.extend( ScreenshotsStore.pending_screenshots())
def _execute_before_spec_hook(request, response, _socket): execution_info = create_execution_context_from( request.specExecutionStartingRequest.currentExecutionInfo) run_hook(request, response, registry.before_spec(execution_info.specification.tags), execution_info) response.executionStatusResponse.executionResult.message.extend( MessagesStore.pending_messages())
def process_execution_starting_request(request, clear=True): if clear: registry.clear() load_impls(get_step_impl_dirs()) execution_info = create_execution_context_from( request.currentExecutionInfo) response = run_hook(request, registry.before_suite(), execution_info) _add_message_and_screenshots(response) return response
def _execute_before_scenario_hook(request, response, _socket): execution_info = create_execution_context_from( request.scenarioExecutionStartingRequest.currentExecutionInfo) tags = list(execution_info.scenario.tags) + \ list(execution_info.specification.tags) run_hook(request, response, registry.before_scenario(tags), execution_info) response.executionStatusResponse.executionResult.message.extend( MessagesStore.pending_messages()) response.executionStatusResponse.executionResult.screenshots.extend( ScreenshotsStore.pending_screenshots())
def _execute_before_suite_hook(request, response, _socket, clear=True): if clear: registry.clear() load_impls(get_step_impl_dir()) if environ.get('DEBUGGING'): ptvsd.enable_attach('', address=('0.0.0.0', int(environ.get('DEBUG_PORT')))) logging.info(ATTACH_DEBUGGER_EVENT) ptvsd.wait_for_attach() execution_info = create_execution_context_from( request.executionStartingRequest.currentExecutionInfo) run_hook(request, response, registry.before_suite(), execution_info)
def _execute_before_suite_hook(request, response, _socket, clear=True): if clear: registry.clear() load_impls(get_step_impl_dir()) if environ.get('DEBUGGING'): ptvsd.enable_attach('', address=('127.0.0.1', int(environ.get('DEBUG_PORT')))) logging.info(ATTACH_DEBUGGER_EVENT) t = Timer(int(environ.get("debugger_wait_time", 30)), handle_detached) t.start() ptvsd.wait_for_attach() t.cancel() execution_info = create_execution_context_from(request.executionStartingRequest.currentExecutionInfo) run_hook(request, response, registry.before_suite(), execution_info) response.executionStatusResponse.executionResult.message.extend(MessagesStore.pending_messages())
def _execute_before_suite_hook(request, response, _socket, clear=True): if clear: registry.clear() load_impls(get_step_impl_dir()) if environ.get('DEBUGGING'): ptvsd.enable_attach('', address=('127.0.0.1', int(environ.get('DEBUG_PORT')))) logging.info(ATTACH_DEBUGGER_EVENT) signal.signal(signal.SIGALRM, handle_detached) signal.alarm(int(environ.get("debugger_wait_time", 30))) ptvsd.wait_for_attach() execution_info = create_execution_context_from( request.executionStartingRequest.currentExecutionInfo) run_hook(request, response, registry.before_suite(), execution_info)
def test_create_execution_context_from(self): message = Message() spec_name, spec_file_name, scenario_name, step_name = 'SPEC_NAME', 'SPEC_FILE_NAME', 'SCENARIO_NAME', 'STEP_NAME' message.executionStartingRequest.currentExecutionInfo.currentSpec.name = spec_name message.executionStartingRequest.currentExecutionInfo.currentSpec.fileName = spec_file_name message.executionStartingRequest.currentExecutionInfo.currentSpec.isFailed = True message.executionStartingRequest.currentExecutionInfo.currentScenario.name = scenario_name message.executionStartingRequest.currentExecutionInfo.currentScenario.isFailed = False message.executionStartingRequest.currentExecutionInfo.currentStep.step.actualStepText = step_name message.executionStartingRequest.currentExecutionInfo.currentStep.isFailed = True specification = Specification(spec_name, spec_file_name, True, []) scenario = Scenario(scenario_name, False, []) step = Step(step_name, True) context = ExecutionContext(specification, scenario, step) expected_execution_context = create_execution_context_from( message.executionStartingRequest.currentExecutionInfo) self.assertEqual(expected_execution_context, context)
def _execute_after_spec_hook(request, response, socket): execution_info = create_execution_context_from(request.specExecutionEndingRequest.currentExecutionInfo) run_hook(request, response, registry.after_spec(execution_info.specification.tags), execution_info)
def process_execution_ending_request(request): execution_info = create_execution_context_from( request.currentExecutionInfo) response = run_hook(request, registry.after_suite(), execution_info) _add_message_and_screenshots(response) return response
def _execute_after_scenario_hook(request, response, _socket): execution_info = create_execution_context_from( request.scenarioExecutionEndingRequest.currentExecutionInfo) tags = list(execution_info.scenario.tags) + list( execution_info.specification.tags) run_hook(request, response, registry.after_scenario(tags), execution_info)
def _execute_before_suite_hook(request, response, socket): execution_info = create_execution_context_from(request.executionStartingRequest.currentExecutionInfo) run_hook(request, response, registry.before_suite(), execution_info)
def _execute_after_step_hook(request, response, socket): execution_info = create_execution_context_from(request.stepExecutionEndingRequest.currentExecutionInfo) tags = list(execution_info.scenario.tags) + list(execution_info.specification.tags) run_hook(request, response, registry.after_step(tags), execution_info) response.executionStatusResponse.executionResult.message.extend(_MessagesStore.pending_messages())
def _execute_before_step_hook(request, response, socket): _MessagesStore.clear() execution_info = create_execution_context_from(request.stepExecutionStartingRequest.currentExecutionInfo) tags = list(execution_info.scenario.tags) + list(execution_info.specification.tags) run_hook(request, response, registry.before_step(tags), execution_info)
def _execute_after_suite_hook(request, response, socket): execution_info = create_execution_context_from(request.executionEndingRequest.currentExecutionInfo) run_hook(request, response, registry.after_suite(), execution_info)
def _execute_after_suite_hook(request, response, _socket): execution_info = create_execution_context_from( request.executionEndingRequest.currentExecutionInfo) run_hook(request, response, registry.after_suite(), execution_info)
def _execute_before_spec_hook(request, response, _socket): execution_info = create_execution_context_from( request.specExecutionStartingRequest.currentExecutionInfo) run_hook(request, response, registry.before_spec(execution_info.specification.tags), execution_info)
def _execute_after_scenario_hook(request, response, socket): execution_info = create_execution_context_from(request.scenarioExecutionEndingRequest.currentExecutionInfo) tags = list(execution_info.scenario.tags) + list(execution_info.specification.tags) run_hook(request, response, registry.after_scenario(tags), execution_info)