execution

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2018 License: GPL-3.0, GPL-3.0 Imports: 31 Imported by: 0

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

View Source
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
)
View Source
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.

View Source
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

View Source
var ExecuteSpecs = func(specDirs []string) int {
	err := validateFlags()
	if err != nil {
		logger.Fatalf(true, err.Error())
	}
	if config.CheckUpdates() {
		i := &install.UpdateFacade{}
		i.BufferUpdateDetails()
		defer i.PrintUpdateBuffer()
	}
	skel.SetupPlugins(MachineReadable)
	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, ", "))
		res.Runner.Kill()
		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 := newExecution(ei)
	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.

View Source
var ExecuteTags = ""

ExecuteTags holds the tags to filter the execution by

View Source
var InParallel bool

InParallel if true executes the specs in parallel else in serial.

View Source
var MachineReadable bool

MachineReadable indicates that the output is in json format

View Source
var NumberOfExecutionStreams int

NumberOfExecutionStreams shows the number of execution streams, in parallel execution.

View Source
var Strategy string

Strategy for execution, can be either 'Eager' or 'Lazy'

Functions

func ListenSuiteEndAndSaveResult added in v0.8.5

func ListenSuiteEndAndSaveResult(wg *sync.WaitGroup)

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL