validation

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 12 Imported by: 14

Documentation

Overview

Validation invokes language runner for every step in serial fashion with the StepValidateRequest and runner gets back with the StepValidateResponse.

Step Level validation

  1. Duplicate step implementation
  2. Step implementation not found : Prints a step implementation stub for every unimplemented step

If there is a validation error it skips that scenario and executes other scenarios in the spec.

Index

Constants

This section is empty.

Variables

View Source
var HideSuggestion bool

HideSuggestion is used decide whether suggestion should be given for the unimplemented step or not based on the flag : --hide-suggestion.

View Source
var TableRows = ""

TableRows is used to check for table rows range validation.

Functions

func FilterDuplicates added in v0.9.9

func FilterDuplicates(validationErrors validationErrors) []error

func NewValidator added in v0.9.9

func NewValidator(s []*gauge.Specification, r runner.Runner, c *gauge.ConceptDictionary) *validator

func Validate

func Validate(args []string)

Validate validates specs and if it has any errors, it exits.

Types

type SpecValidationError added in v0.8.0

type SpecValidationError struct {
	// contains filtered or unexported fields
}

func NewSpecValidationError added in v0.8.0

func NewSpecValidationError(m string, f string) SpecValidationError

NewSpecValidationError generates new spec validation error with error message and filename.

func (SpecValidationError) Error added in v0.8.0

func (s SpecValidationError) Error() string

Error prints a spec validation error with filename and error message.

type SpecValidator added in v0.9.5

type SpecValidator struct {
	// contains filtered or unexported fields
}

func (*SpecValidator) Comment added in v0.9.5

func (v *SpecValidator) Comment(comment *gauge.Comment)

func (*SpecValidator) DataTable added in v0.9.5

func (v *SpecValidator) DataTable(dataTable *gauge.DataTable)

func (*SpecValidator) Heading added in v0.9.5

func (v *SpecValidator) Heading(heading *gauge.Heading)

func (*SpecValidator) Scenario added in v0.9.5

func (v *SpecValidator) Scenario(scenario *gauge.Scenario)

func (*SpecValidator) Specification added in v0.9.5

func (v *SpecValidator) Specification(specification *gauge.Specification)

Validates data table for the range, if any error found append to the validation errors

func (*SpecValidator) Step added in v0.9.5

func (v *SpecValidator) Step(s *gauge.Step)

Validates a step. If validation result from runner is not valid then it creates a new validation error. If the error type is StepValidateResponse_STEP_IMPLEMENTATION_NOT_FOUND then gives suggestion with step implementation stub.

func (*SpecValidator) Table added in v0.9.5

func (v *SpecValidator) Table(dataTable *gauge.Table)

func (*SpecValidator) Tags added in v0.9.5

func (v *SpecValidator) Tags(tags *gauge.Tags)

func (*SpecValidator) TearDown added in v0.9.5

func (v *SpecValidator) TearDown(step *gauge.TearDown)

type StepValidationError

type StepValidationError struct {
	// contains filtered or unexported fields
}

func NewStepValidationError added in v0.8.0

func NewStepValidationError(s *gauge.Step, m string, f string, e *gm.StepValidateResponse_ErrorType, suggestion string) StepValidationError

NewStepValidationError generates new step validation error with error message, filename and error type.

func (StepValidationError) Error

func (s StepValidationError) Error() string

Error prints a step validation error with filename, line number, error message, step text and suggestion in case of step implementation not found.

func (StepValidationError) ErrorType added in v0.9.5

func (StepValidationError) FileName added in v0.9.5

func (s StepValidationError) FileName() string

func (StepValidationError) Message added in v0.9.5

func (s StepValidationError) Message() string

func (StepValidationError) Step added in v0.9.5

func (s StepValidationError) Step() *gauge.Step

func (StepValidationError) Suggestion added in v0.9.2

func (s StepValidationError) Suggestion() string

type ValidationResult added in v0.6.2

type ValidationResult struct {
	SpecCollection *gauge.SpecCollection
	ErrMap         *gauge.BuildErrors
	Runner         runner.Runner
	Errs           []error
	ParseOk        bool
}

func NewValidationResult added in v0.6.2

func NewValidationResult(s *gauge.SpecCollection, errMap *gauge.BuildErrors, r runner.Runner, parseOk bool, e ...error) *ValidationResult

NewValidationResult creates a new Validation result

func ValidateSpecs

func ValidateSpecs(specsToValidate []string, debug bool) *ValidationResult

ValidateSpecs parses the specs, creates a new validator and call the runner to get the validation result.

Jump to

Keyboard shortcuts

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