func (executor *specExecutor) executeScenario(scenario *parser.Scenario) *result.ScenarioResult { executor.currentExecutionInfo.CurrentScenario = &gauge_messages.ScenarioInfo{Name: proto.String(scenario.Heading.Value), Tags: getTagValue(scenario.Tags), IsFailed: proto.Bool(false)} scenarioResult := &result.ScenarioResult{parser.NewProtoScenario(scenario)} executor.addAllItemsForScenarioExecution(scenario, scenarioResult) scenarioResult.ProtoScenario.Skipped = proto.Bool(false) if _, ok := executor.errMap.scenarioErrs[scenario]; ok { executor.setSkipInfoInResult(scenarioResult, scenario) return scenarioResult } executor.consoleReporter.ScenarioStart(scenario.Heading.Value) beforeHookExecutionStatus := executor.executeBeforeScenarioHook(scenarioResult) if beforeHookExecutionStatus.GetFailed() { result.AddPreHook(scenarioResult, beforeHookExecutionStatus) setScenarioFailure(executor.currentExecutionInfo) printStatus(beforeHookExecutionStatus, executor.consoleReporter) } else { executor.executeContextItems(scenarioResult) if !scenarioResult.GetFailure() { executor.executeScenarioItems(scenarioResult) } executor.executeTearDownItems(scenarioResult) } afterHookExecutionStatus := executor.executeAfterScenarioHook(scenarioResult) result.AddPostHook(scenarioResult, afterHookExecutionStatus) scenarioResult.UpdateExecutionTime() if afterHookExecutionStatus.GetFailed() { setScenarioFailure(executor.currentExecutionInfo) printStatus(afterHookExecutionStatus, executor.consoleReporter) } executor.consoleReporter.ScenarioEnd(scenarioResult.GetFailure()) return scenarioResult }
func (executor *specExecutor) executeScenario(scenario *parser.Scenario) *result.ScenarioResult { executor.currentExecutionInfo.CurrentScenario = &gauge_messages.ScenarioInfo{Name: proto.String(scenario.Heading.Value), Tags: getTagValue(scenario.Tags), IsFailed: proto.Bool(false)} scenarioResult := &result.ScenarioResult{parser.NewProtoScenario(scenario)} executor.addAllItemsForScenarioExecution(scenario, scenarioResult) if _, ok := executor.errMap.scenarioErrs[scenario]; ok { executor.specResult.ScenarioSkippedCount += 1 return scenarioResult } executor.logger.Info("Executing scenario: %s", scenario.Heading.Value) beforeHookExecutionStatus := executor.executeBeforeScenarioHook(scenarioResult) if beforeHookExecutionStatus.GetFailed() { result.AddPreHook(scenarioResult, beforeHookExecutionStatus) setScenarioFailure(executor.currentExecutionInfo) } else { executor.executeContextItems(scenarioResult) if !scenarioResult.GetFailure() { executor.executeScenarioItems(scenarioResult) } } afterHookExecutionStatus := executor.executeAfterScenarioHook(scenarioResult) result.AddPostHook(scenarioResult, afterHookExecutionStatus) scenarioResult.UpdateExecutionTime() return scenarioResult }
func (s *specExecutor) getSkippedScenarioResult(scenario *parser.Scenario) *result.ScenarioResult { scenarioResult := &result.ScenarioResult{parser.NewProtoScenario(scenario)} s.addAllItemsForScenarioExecution(scenario, scenarioResult) s.setSkipInfoInResult(scenarioResult, scenario) return scenarioResult }