本文整理匯總了Golang中github.com/getgauge/gauge/gauge_messages.ProtoStep.GetStepExecutionResult方法的典型用法代碼示例。如果您正苦於以下問題:Golang ProtoStep.GetStepExecutionResult方法的具體用法?Golang ProtoStep.GetStepExecutionResult怎麽用?Golang ProtoStep.GetStepExecutionResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/getgauge/gauge/gauge_messages.ProtoStep
的用法示例。
在下文中一共展示了ProtoStep.GetStepExecutionResult方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: executeStep
func (executor *specExecutor) executeStep(protoStep *gauge_messages.ProtoStep) bool {
stepRequest := executor.createStepRequest(protoStep)
executor.logger.Debug("Executing Step: %s", formatter.FormatStep(parser.CreateStepFromStepRequest(stepRequest)))
protoStepExecResult := &gauge_messages.ProtoStepExecutionResult{}
executor.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: proto.Bool(false)}
beforeHookStatus := executor.executeBeforeStepHook()
if beforeHookStatus.GetFailed() {
protoStepExecResult.PreHookFailure = result.GetProtoHookFailure(beforeHookStatus)
protoStepExecResult.ExecutionResult = &gauge_messages.ProtoExecutionResult{Failed: proto.Bool(true)}
setStepFailure(executor.currentExecutionInfo, executor.logger)
printStatus(beforeHookStatus, executor.logger)
} else {
executeStepMessage := &gauge_messages.Message{MessageType: gauge_messages.Message_ExecuteStep.Enum(), ExecuteStepRequest: stepRequest}
stepExecutionStatus := executeAndGetStatus(executor.runner, executeStepMessage)
if stepExecutionStatus.GetFailed() {
setStepFailure(executor.currentExecutionInfo, executor.logger)
printStatus(stepExecutionStatus, executor.logger)
}
protoStepExecResult.ExecutionResult = stepExecutionStatus
}
afterStepHookStatus := executor.executeAfterStepHook()
addExecutionTimes(protoStepExecResult, beforeHookStatus, afterStepHookStatus)
if afterStepHookStatus.GetFailed() {
setStepFailure(executor.currentExecutionInfo, executor.logger)
printStatus(afterStepHookStatus, executor.logger)
protoStepExecResult.PostHookFailure = result.GetProtoHookFailure(afterStepHookStatus)
protoStepExecResult.ExecutionResult.Failed = proto.Bool(true)
}
protoStepExecResult.Skipped = protoStep.StepExecutionResult.Skipped
protoStepExecResult.SkippedReason = protoStep.StepExecutionResult.SkippedReason
protoStep.StepExecutionResult = protoStepExecResult
return protoStep.GetStepExecutionResult().GetExecutionResult().GetFailed()
}
示例2: executeStep
func (e *stepExecutor) executeStep(protoStep *gauge_messages.ProtoStep) bool {
stepRequest := e.createStepRequest(protoStep)
e.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: proto.Bool(false)}
stepText := formatter.FormatStep(parser.CreateStepFromStepRequest(stepRequest))
e.consoleReporter.StepStart(stepText)
protoStepExecResult := &gauge_messages.ProtoStepExecutionResult{ExecutionResult: &gauge_messages.ProtoExecutionResult{}}
e.notifyBeforeStepHook(protoStepExecResult)
if !protoStepExecResult.ExecutionResult.GetFailed() {
executeStepMessage := &gauge_messages.Message{MessageType: gauge_messages.Message_ExecuteStep.Enum(), ExecuteStepRequest: stepRequest}
stepExecutionStatus := executeAndGetStatus(e.runner, executeStepMessage)
if stepExecutionStatus.GetFailed() {
setStepFailure(e.currentExecutionInfo)
}
protoStepExecResult.ExecutionResult = stepExecutionStatus
}
e.notifyAfterStepHook(protoStepExecResult)
protoStepExecResult.Skipped = protoStep.StepExecutionResult.Skipped
protoStepExecResult.SkippedReason = protoStep.StepExecutionResult.SkippedReason
protoStep.StepExecutionResult = protoStepExecResult
stepFailed := protoStep.GetStepExecutionResult().GetExecutionResult().GetFailed()
if stepFailed {
result := protoStep.GetStepExecutionResult().GetExecutionResult()
e.consoleReporter.Errorf("\nFailed Step: %s", e.currentExecutionInfo.CurrentStep.Step.GetActualStepText())
e.consoleReporter.Errorf("Error Message: %s", strings.TrimSpace(result.GetErrorMessage()))
e.consoleReporter.Errorf("Stacktrace: \n%s", result.GetStackTrace())
}
e.consoleReporter.StepEnd(stepFailed)
return stepFailed
}
示例3: executeStep
func (executor *specExecutor) executeStep(protoStep *gauge_messages.ProtoStep) bool {
stepRequest := executor.createStepRequest(protoStep)
stepText := formatter.FormatStep(parser.CreateStepFromStepRequest(stepRequest))
executor.consoleReporter.StepStart(stepText)
protoStepExecResult := &gauge_messages.ProtoStepExecutionResult{}
executor.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: proto.Bool(false)}
beforeHookStatus := executor.executeBeforeStepHook()
if beforeHookStatus.GetFailed() {
protoStepExecResult.PreHookFailure = result.GetProtoHookFailure(beforeHookStatus)
protoStepExecResult.ExecutionResult = &gauge_messages.ProtoExecutionResult{Failed: proto.Bool(true)}
setStepFailure(executor.currentExecutionInfo, executor.consoleReporter)
printStatus(beforeHookStatus, executor.consoleReporter)
} else {
executeStepMessage := &gauge_messages.Message{MessageType: gauge_messages.Message_ExecuteStep.Enum(), ExecuteStepRequest: stepRequest}
stepExecutionStatus := executeAndGetStatus(executor.runner, executeStepMessage)
if stepExecutionStatus.GetFailed() {
setStepFailure(executor.currentExecutionInfo, executor.consoleReporter)
}
protoStepExecResult.ExecutionResult = stepExecutionStatus
}
afterStepHookStatus := executor.executeAfterStepHook()
addExecutionTimes(protoStepExecResult, beforeHookStatus, afterStepHookStatus)
if afterStepHookStatus.GetFailed() {
setStepFailure(executor.currentExecutionInfo, executor.consoleReporter)
printStatus(afterStepHookStatus, executor.consoleReporter)
protoStepExecResult.PostHookFailure = result.GetProtoHookFailure(afterStepHookStatus)
protoStepExecResult.ExecutionResult.Failed = proto.Bool(true)
}
protoStepExecResult.ExecutionResult.Message = afterStepHookStatus.Message
protoStepExecResult.Skipped = protoStep.StepExecutionResult.Skipped
protoStepExecResult.SkippedReason = protoStep.StepExecutionResult.SkippedReason
protoStep.StepExecutionResult = protoStepExecResult
stepFailed := protoStep.GetStepExecutionResult().GetExecutionResult().GetFailed()
executor.consoleReporter.StepEnd(stepFailed)
if stepFailed {
result := protoStep.GetStepExecutionResult().GetExecutionResult()
executor.consoleReporter.Error("Failed Step: %s", executor.currentExecutionInfo.CurrentStep.Step.GetActualStepText())
executor.consoleReporter.Error("Error Message: %s", strings.TrimSpace(result.GetErrorMessage()))
executor.consoleReporter.Error("Stacktrace: \n%s", result.GetStackTrace())
}
return stepFailed
}
示例4: executeStep
func (executor *specExecutor) executeStep(protoStep *gauge_messages.ProtoStep) bool {
stepRequest := executor.createStepRequest(protoStep)
stepWithResolvedArgs := parser.CreateStepFromStepRequest(stepRequest)
executor.writer.StepStarting(stepWithResolvedArgs)
protoStepExecResult := &gauge_messages.ProtoStepExecutionResult{}
executor.currentExecutionInfo.CurrentStep = &gauge_messages.StepInfo{Step: stepRequest, IsFailed: proto.Bool(false)}
beforeHookStatus := executor.executeBeforeStepHook()
if beforeHookStatus.GetFailed() {
protoStepExecResult.PreHookFailure = result.GetProtoHookFailure(beforeHookStatus)
protoStepExecResult.ExecutionResult = &gauge_messages.ProtoExecutionResult{Failed: proto.Bool(true)}
setStepFailure(executor.currentExecutionInfo)
printStatus(beforeHookStatus, executor.writer)
} else {
executeStepMessage := &gauge_messages.Message{MessageType: gauge_messages.Message_ExecuteStep.Enum(), ExecuteStepRequest: stepRequest}
stepExecutionStatus := executeAndGetStatus(executor.runner, executeStepMessage, executor.writer)
if stepExecutionStatus.GetFailed() {
setStepFailure(executor.currentExecutionInfo)
printStatus(stepExecutionStatus, executor.writer)
}
protoStepExecResult.ExecutionResult = stepExecutionStatus
}
afterStepHookStatus := executor.executeAfterStepHook()
addExecutionTimes(protoStepExecResult, beforeHookStatus, afterStepHookStatus)
if afterStepHookStatus.GetFailed() {
setStepFailure(executor.currentExecutionInfo)
printStatus(afterStepHookStatus, executor.writer)
protoStepExecResult.PostHookFailure = result.GetProtoHookFailure(afterStepHookStatus)
protoStepExecResult.ExecutionResult.Failed = proto.Bool(true)
}
executor.writer.StepFinished(stepWithResolvedArgs, protoStepExecResult.GetExecutionResult().GetFailed())
protoStep.StepExecutionResult = protoStepExecResult
return protoStep.GetStepExecutionResult().GetExecutionResult().GetFailed()
}