Documentation ¶
Overview ¶
Package execution handles gauge's execution of spec/scenario/steps
Execution can be of two types - Simple execution - Paralell execution Execution Flow : - Checks for updates - Validation - Init Registry - Saving Execution result Strategy - Lazy : Lazy is a parallelization strategy for execution. In this case tests assignment will be dynamic during execution, i.e. assign the next spec in line to the stream that has completed it’s previous execution and is waiting for more work. - Eager : Eager is a parallelization strategy for execution. In this case tests are distributed before execution, thus making them an equal number based distribution.
Index ¶
Constants ¶
const ( // Success indicated successful operation Success = 0 // ExecutionFailed indicates gauge's execution failed ExecutionFailed = 1 // ParseFailed indicates one or more parse errors ParseFailed = 2 // ValidationFailed indicates one or more validation errors ValidationFailed = 3 )
const Eager string = "eager"
Eager is a parallelization strategy for execution. In this case tests are distributed before execution, thus making them an equal number based distribution.
const Lazy string = "lazy"
Lazy is a parallelization strategy for execution. In this case tests assignment will be dynamic during execution, i.e. assign the next spec in line to the stream that has completed it’s previous execution and is waiting for more work.
Variables ¶
var ExecuteSpecs = func(specDirs []string) int { err := validateFlags() if err != nil { logger.Fatal(true, err.Error()) } if config.CheckUpdates() { i := &install.UpdateFacade{} i.BufferUpdateDetails() defer i.PrintUpdateBuffer() } skel.SetupPlugins(MachineReadable) err = os.Setenv(gaugeParallelStreamCountEnv, strconv.Itoa(NumberOfExecutionStreams)) if err != nil { logger.Fatalf(true, "failed to set env %s. %s", gaugeParallelStreamCountEnv, err.Error()) } res := validation.ValidateSpecs(specDirs, false) if len(res.Errs) > 0 { if res.ParseOk { return ParseFailed } return ValidationFailed } if res.SpecCollection.Size() < 1 { logger.Infof(true, "No specifications found in %s.", strings.Join(specDirs, ", ")) err := res.Runner.Kill() if err != nil { logger.Errorf(false, "unable to kill runner: %s", err.Error()) } if res.ParseOk { return Success } return ExecutionFailed } event.InitRegistry() wg := &sync.WaitGroup{} reporter.ListenExecutionEvents(wg) rerun.ListenFailedScenarios(wg, specDirs) if env.SaveExecutionResult() { ListenSuiteEndAndSaveResult(wg) } defer wg.Wait() ei := newExecutionInfo(res.SpecCollection, res.Runner, nil, res.ErrMap, InParallel, 0) e := ei.getExecutor() logger.Debug(true, "Run started") return printExecutionResult(e.run(), res.ParseOk) }
ExecuteSpecs : Check for updates, validates the specs (by invoking the respective language runners), initiates the registry which is needed for console reporting, execution API and Rerunning of specs and finally saves the execution result as binary in .gauge folder.
var ExecuteTags = ""
ExecuteTags holds the tags to filter the execution by
var ExecutionArgs []*gauge.ExecutionArg
var InParallel bool
InParallel if true executes the specs in parallel else in serial.
var MachineReadable bool
MachineReadable indicates that the output is in json format
var MaxRetriesCount int
Count of iterations
var NumberOfExecutionStreams int
NumberOfExecutionStreams shows the number of execution streams, in parallel execution.
var RetryOnlyTags string
Tags to filter specs/scenarios to retry
var Strategy string
Strategy for execution, can be either 'Eager' or 'Lazy'
var TagsToFilterForParallelRun string
var Verbose bool
Verbose if true prints additional details about the execution
Functions ¶
func ListenSuiteEndAndSaveResult ¶ added in v0.8.5
ListenSuiteEndAndSaveResult listens to execution events and writes the failed scenarios to JSON file
func ReadLastExecutionResult ¶ added in v1.0.3
func ReadLastExecutionResult() (interface{}, error)
ReadLastExecutionResult returns the result of previous execution in JSON format This is stored in $GAUGE_PROJECT_ROOT/.gauge/executionStatus.json file after every execution
func SetTableRows ¶ added in v0.8.4
func SetTableRows(tableRows string)
SetTableRows is used to limit data driven execution to specific rows
Types ¶
This section is empty.