gauge

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2018 License: GPL-3.0, GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpecHeading     = 0
	ScenarioHeading = 1
)

Variables

This section is empty.

Functions

func ConvertToProtoItem added in v0.3.2

func ConvertToProtoItem(item Item) *gauge_messages.ProtoItem

func ConvertToProtoSpec added in v0.3.2

func ConvertToProtoSpec(spec *Specification) *gauge_messages.ProtoSpec

func ConvertToProtoStepValue added in v0.3.2

func ConvertToProtoStepValue(stepValue *StepValue) *gauge_messages.ProtoStepValue

func ConvertToProtoSuiteResult added in v0.3.2

func ConvertToProtoSuiteResult(suiteResult *result.SuiteResult) *gauge_messages.ProtoSuiteResult

func NewProtoScenario added in v0.3.2

func NewProtoScenario(scenario *Scenario) *gauge_messages.ProtoScenario

func NewSpecResult added in v0.3.2

func NewSpecResult(specification *Specification) *result.SpecResult

func UsesArgs added in v0.8.4

func UsesArgs(steps []*Step, args ...string) bool

Types

type ArgLookup added in v0.3.2

type ArgLookup struct {
	//helps to access the index of an arg at O(1)
	ParamIndexMap map[string]int
	// contains filtered or unexported fields
}

func (*ArgLookup) AddArgName added in v0.3.2

func (lookup *ArgLookup) AddArgName(argName string)

func (*ArgLookup) AddArgValue added in v0.3.2

func (lookup *ArgLookup) AddArgValue(param string, stepArg *StepArg) error

func (*ArgLookup) ContainsArg added in v0.3.2

func (lookup *ArgLookup) ContainsArg(param string) bool

func (*ArgLookup) FromDataTable added in v0.3.2

func (lookup *ArgLookup) FromDataTable(datatable *Table) *ArgLookup

create an empty lookup with only args to resolve dynamic params for steps

func (*ArgLookup) FromDataTableRow added in v0.3.2

func (lookup *ArgLookup) FromDataTableRow(datatable *Table, index int) (*ArgLookup, error)

func (*ArgLookup) GetArg added in v0.3.2

func (lookup *ArgLookup) GetArg(param string) (*StepArg, error)

func (*ArgLookup) GetCopy added in v0.3.2

func (lookup *ArgLookup) GetCopy() (*ArgLookup, error)

func (ArgLookup) String added in v0.3.2

func (lookup ArgLookup) String() string

type ArgType added in v0.3.2

type ArgType string
const (
	Static               ArgType = "static"
	Dynamic              ArgType = "dynamic"
	TableArg             ArgType = "table"
	SpecialString        ArgType = "special_string"
	SpecialTable         ArgType = "special_table"
	ParameterPlaceholder         = "{}"
)

type BuildErrors added in v0.8.0

type BuildErrors struct {
	SpecErrs     map[*Specification][]error
	ScenarioErrs map[*Scenario][]error
	StepErrs     map[*Step]error
}

func NewBuildErrors added in v0.8.0

func NewBuildErrors() *BuildErrors

func (*BuildErrors) HasErrors added in v0.8.0

func (e *BuildErrors) HasErrors() bool

type ByLineNo added in v0.3.2

type ByLineNo []*Concept

func (ByLineNo) Len added in v0.3.2

func (s ByLineNo) Len() int

func (ByLineNo) Less added in v0.3.2

func (s ByLineNo) Less(i, j int) bool

func (ByLineNo) Swap added in v0.3.2

func (s ByLineNo) Swap(i, j int)

type Comment added in v0.3.2

type Comment struct {
	Value  string
	LineNo int
}

func (*Comment) Kind added in v0.3.2

func (comment *Comment) Kind() TokenKind

type Concept

type Concept struct {
	ConceptStep *Step
	FileName    string
}

type ConceptDictionary added in v0.3.2

type ConceptDictionary struct {
	ConceptsMap map[string]*Concept
	// contains filtered or unexported fields
}

func NewConceptDictionary added in v0.3.2

func NewConceptDictionary() *ConceptDictionary

func (*ConceptDictionary) Remove added in v0.9.6

func (dict *ConceptDictionary) Remove(stepValue string)

func (*ConceptDictionary) ReplaceNestedConceptSteps added in v0.3.2

func (dict *ConceptDictionary) ReplaceNestedConceptSteps(conceptStep *Step) error

func (*ConceptDictionary) Search added in v0.3.2

func (dict *ConceptDictionary) Search(stepValue string) *Concept

func (*ConceptDictionary) UpdateLookupForNestedConcepts added in v0.3.2

func (dict *ConceptDictionary) UpdateLookupForNestedConcepts() error

type DataTable added in v0.3.2

type DataTable struct {
	Table      Table
	Value      string
	LineNo     int
	IsExternal bool
}

func (*DataTable) IsInitialized added in v0.3.2

func (dataTable *DataTable) IsInitialized() bool

func (*DataTable) Kind added in v0.3.2

func (externalTable *DataTable) Kind() TokenKind

type Heading added in v0.3.2

type Heading struct {
	Value       string
	LineNo      int
	HeadingType HeadingType
}

func (*Heading) Kind added in v0.3.2

func (heading *Heading) Kind() TokenKind

type HeadingType added in v0.3.2

type HeadingType int

type Item added in v0.3.2

type Item interface {
	Kind() TokenKind
}

type ItemProcessor added in v0.9.0

type ItemProcessor interface {
	Specification(*Specification)
	Heading(*Heading)
	Tags(*Tags)
	Table(*Table)
	DataTable(*DataTable)
	Scenario(*Scenario)
	Step(*Step)
	TearDown(*TearDown)
	Comment(*Comment)
}

type ItemQueue added in v0.9.0

type ItemQueue struct {
	Items []Item
}

func (*ItemQueue) Next added in v0.9.0

func (queue *ItemQueue) Next() Item

func (*ItemQueue) Peek added in v0.9.0

func (queue *ItemQueue) Peek() Item

type Scenario added in v0.3.2

type Scenario struct {
	Heading           *Heading
	Steps             []*Step
	Comments          []*Comment
	Tags              *Tags
	Items             []Item
	DataTableRow      Table
	DataTableRowIndex int
	Span              *Span
}

func (*Scenario) AddComment added in v0.3.2

func (scenario *Scenario) AddComment(comment *Comment)

func (*Scenario) AddHeading added in v0.3.2

func (scenario *Scenario) AddHeading(heading *Heading)

func (*Scenario) AddItem added in v0.3.2

func (scenario *Scenario) AddItem(itemToAdd Item)

func (*Scenario) AddStep added in v0.3.2

func (scenario *Scenario) AddStep(step *Step)

func (*Scenario) AddTags added in v0.3.2

func (scenario *Scenario) AddTags(tags *Tags)

func (*Scenario) InSpan added in v0.5.0

func (scenario *Scenario) InSpan(lineNumber int) bool

func (Scenario) Kind added in v0.3.2

func (scenario Scenario) Kind() TokenKind

func (*Scenario) LatestStep added in v0.3.2

func (scenario *Scenario) LatestStep() *Step

func (*Scenario) NTags added in v0.5.0

func (scenario *Scenario) NTags() int

func (*Scenario) UsesArgsInSteps added in v0.8.4

func (scenario *Scenario) UsesArgsInSteps(args ...string) bool

type Span added in v0.5.0

type Span struct {
	Start int
	End   int
}

Span represents scope of Scenario based on line number

type SpecCollection added in v0.4.0

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

func NewSpecCollection added in v0.4.0

func NewSpecCollection(s []*Specification, groupDataTableSpecs bool) *SpecCollection

func (*SpecCollection) Add added in v0.4.0

func (s *SpecCollection) Add(spec *Specification)

func (*SpecCollection) HasNext added in v0.4.0

func (s *SpecCollection) HasNext() bool

func (*SpecCollection) Next added in v0.4.0

func (s *SpecCollection) Next() []*Specification

func (*SpecCollection) Size added in v0.4.0

func (s *SpecCollection) Size() int

func (*SpecCollection) SpecNames added in v0.4.0

func (s *SpecCollection) SpecNames() []string

func (*SpecCollection) Specs added in v0.4.0

func (s *SpecCollection) Specs() (specs []*Specification)

type SpecItemFilter added in v0.3.2

type SpecItemFilter interface {
	Filter(Item) bool
}

type Specification added in v0.3.2

type Specification struct {
	Heading       *Heading
	Scenarios     []*Scenario
	Comments      []*Comment
	DataTable     DataTable
	Contexts      []*Step
	FileName      string
	Tags          *Tags
	Items         []Item
	TearDownSteps []*Step
}

func (*Specification) AddComment added in v0.3.2

func (spec *Specification) AddComment(comment *Comment)

func (*Specification) AddContext added in v0.3.2

func (spec *Specification) AddContext(contextStep *Step)

func (*Specification) AddDataTable added in v0.3.2

func (spec *Specification) AddDataTable(table *Table)

func (*Specification) AddExternalDataTable added in v0.3.2

func (spec *Specification) AddExternalDataTable(externalTable *DataTable)

func (*Specification) AddHeading added in v0.3.2

func (spec *Specification) AddHeading(heading *Heading)

func (*Specification) AddItem added in v0.3.2

func (spec *Specification) AddItem(itemToAdd Item)

func (*Specification) AddScenario added in v0.3.2

func (spec *Specification) AddScenario(scenario *Scenario)

func (*Specification) AddTags added in v0.3.2

func (spec *Specification) AddTags(tags *Tags)

func (*Specification) AllItems added in v0.9.0

func (spec *Specification) AllItems() (items []Item)

func (*Specification) Filter added in v0.3.2

func (spec *Specification) Filter(filter SpecItemFilter)

func (*Specification) GetSpecItems added in v0.3.2

func (spec *Specification) GetSpecItems() []Item

func (*Specification) Kind added in v0.5.0

func (spec *Specification) Kind() TokenKind

func (*Specification) LatestContext added in v0.3.2

func (spec *Specification) LatestContext() *Step

func (*Specification) LatestScenario added in v0.3.2

func (spec *Specification) LatestScenario() *Scenario

func (*Specification) LatestTeardown added in v0.3.2

func (spec *Specification) LatestTeardown() *Step

func (*Specification) NTags added in v0.5.0

func (spec *Specification) NTags() int

func (*Specification) PopulateConceptLookup added in v0.3.2

func (spec *Specification) PopulateConceptLookup(lookup *ArgLookup, conceptArgs []*StepArg, stepArgs []*StepArg) error

func (*Specification) ProcessConceptStepsFrom added in v0.3.2

func (spec *Specification) ProcessConceptStepsFrom(conceptDictionary *ConceptDictionary) error

func (*Specification) RenameSteps added in v0.3.2

func (spec *Specification) RenameSteps(oldStep Step, newStep Step, orderMap map[int]int) bool

func (*Specification) Steps added in v0.9.8

func (spec *Specification) Steps() []*Step

Steps gives all the steps present in Specification

func (*Specification) Traverse added in v0.3.2

func (spec *Specification) Traverse(processor ItemProcessor, queue *ItemQueue)

func (*Specification) UsesArgsInContextTeardown added in v0.8.4

func (spec *Specification) UsesArgsInContextTeardown(args ...string) bool

type Step

type Step struct {
	LineNo         int
	FileName       string
	Value          string
	LineText       string
	Args           []*StepArg
	IsConcept      bool
	Lookup         ArgLookup
	ConceptSteps   []*Step
	Fragments      []*gauge_messages.Fragment
	Parent         *Step
	HasInlineTable bool
	Items          []Item
	PreComments    []*Comment
	Suffix         string
}

func (*Step) AddArgs added in v0.3.2

func (step *Step) AddArgs(args ...*StepArg)

func (*Step) AddInlineTableHeaders added in v0.3.2

func (step *Step) AddInlineTableHeaders(headers []string)

func (*Step) AddInlineTableRow added in v0.3.2

func (step *Step) AddInlineTableRow(row []TableCell)

func (*Step) CopyFrom added in v0.3.2

func (step *Step) CopyFrom(another *Step)

func (*Step) GetArg added in v0.3.2

func (step *Step) GetArg(name string) (*StepArg, error)

func (*Step) GetCopy added in v0.3.2

func (step *Step) GetCopy() (*Step, error)

Not copying parent as it enters an infinite loop in case of nested concepts. This is because the steps under the concept are copied and their parent copying again comes back to copy the same concept.

func (*Step) GetFragments added in v0.5.0

func (step *Step) GetFragments() []*gauge_messages.Fragment

func (*Step) GetLastArg added in v0.9.8

func (step *Step) GetLastArg() *StepArg

func (*Step) GetLineText added in v0.5.0

func (step *Step) GetLineText() string

func (*Step) InConcept added in v0.5.0

func (step *Step) InConcept() bool

InConcept returns true if the step belongs to a concept

func (Step) Kind added in v0.3.2

func (step Step) Kind() TokenKind

func (*Step) PopulateFragments added in v0.3.2

func (step *Step) PopulateFragments()

func (*Step) Rename added in v0.3.2

func (step *Step) Rename(oldStep Step, newStep Step, isRefactored bool, orderMap map[int]int, isConcept *bool) bool

func (*Step) ReplaceArgsWithDynamic added in v0.3.2

func (step *Step) ReplaceArgsWithDynamic(args []*StepArg)

func (*Step) UsesDynamicArgs added in v0.8.4

func (step *Step) UsesDynamicArgs(args ...string) bool

type StepArg added in v0.3.2

type StepArg struct {
	Name    string
	Value   string
	ArgType ArgType
	Table   Table
}

func (*StepArg) ArgValue added in v0.9.1

func (stepArg *StepArg) ArgValue() string

func (*StepArg) String added in v0.3.2

func (stepArg *StepArg) String() string

type StepValue added in v0.3.2

type StepValue struct {
	Args                   []string
	StepValue              string
	ParameterizedStepValue string
}

type Table added in v0.3.2

type Table struct {
	Columns [][]TableCell
	Headers []string
	LineNo  int
	// contains filtered or unexported fields
}

func NewTable added in v0.7.0

func NewTable(headers []string, cols [][]TableCell, lineNo int) *Table

func (*Table) AddHeaders added in v0.3.2

func (table *Table) AddHeaders(columnNames []string)

func (*Table) AddRowValues added in v0.3.2

func (table *Table) AddRowValues(rowValues []string)

func (*Table) Get added in v0.3.2

func (table *Table) Get(header string) ([]TableCell, error)

func (*Table) GetDynamicArgs added in v0.3.2

func (table *Table) GetDynamicArgs() []string

func (*Table) GetRowCount added in v0.3.2

func (table *Table) GetRowCount() int

func (*Table) IsInitialized added in v0.3.2

func (table *Table) IsInitialized() bool

func (*Table) Kind added in v0.3.2

func (table *Table) Kind() TokenKind

func (*Table) Rows added in v0.3.2

func (table *Table) Rows() [][]string

func (*Table) String added in v0.3.2

func (table *Table) String() string

type TableCell added in v0.3.2

type TableCell struct {
	Value    string
	CellType ArgType
}

func GetDefaultTableCell added in v0.3.2

func GetDefaultTableCell() TableCell

func GetTableCell added in v0.3.2

func GetTableCell(value string) TableCell

func (*TableCell) GetValue added in v0.3.2

func (cell *TableCell) GetValue() string

type Tags added in v0.3.2

type Tags struct {
	RawValues [][]string
}

func (*Tags) Add added in v0.9.2

func (tags *Tags) Add(values []string)

func (*Tags) Kind added in v0.3.2

func (tags *Tags) Kind() TokenKind

func (*Tags) Values added in v0.3.2

func (tags *Tags) Values() (val []string)

type TearDown added in v0.3.2

type TearDown struct {
	LineNo int
	Value  string
}

func (*TearDown) Kind added in v0.3.2

func (t *TearDown) Kind() TokenKind

type TokenKind added in v0.3.2

type TokenKind int
const (
	SpecKind TokenKind = iota
	TagKind
	ScenarioKind
	CommentKind
	StepKind
	TableHeader
	TableRow
	HeadingKind
	TableKind
	DataTableKind
	TearDownKind
)

Jump to

Keyboard shortcuts

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