model

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Formats

func Formats() []string

Formats returns supported output formats.

Types

type Background

type Background struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// Keyword of the block.
	Keyword string `json:"Keyword"`
	// Name of the block.
	Name string `json:"Name"`
	// Description of the block.
	Description string `json:"Description"`
	// Steps of the background.
	Steps []*Step `json:"Steps"`
	// ID is a unique identifier of the block.
	ID string `json:"ID"`
	// contains filtered or unexported fields
}

Background is a gherkin's background.

Occasionally you’ll find yourself repeating the same Given steps in all of the scenarios in a Feature.

Since it is repeated in every scenario, this is an indication that those steps are not essential to describe the scenarios; they are incidental details. You can literally move such Given steps to the background, by grouping them under a Background section.

A Background allows you to add some context to the scenarios that follow it. It can contain one or more Given steps, which are run before each scenario, but after any Before hooks.

A Background is placed before the first Scenario/Example, at the same level of indentation.

More details: https://cucumber.io/docs/gherkin/reference/#background

func (*Background) From

func (to *Background) From(from *messages.Background) *Background

From converts to Background.

type Comment

type Comment struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// Text of the block.
	Text string `json:"Text"`
}

Comment is a gherkin's comment.

func (*Comment) From

func (to *Comment) From(from *messages.Comment) *Comment

From converts to Comment.

type CommentsSlice

type CommentsSlice []*Comment

CommentsSlice is a slice of comments.

func (CommentsSlice) From

func (to CommentsSlice) From(from []*messages.Comment) CommentsSlice

From converts to CommentsSlice.

type DataTable

type DataTable struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// Rows of the table.
	Rows []*TableRow `json:"Rows"`
}

DataTable is a gherkin's dataTable.

func (*DataTable) From

func (to *DataTable) From(from *messages.DataTable) *DataTable

From converts to DataTable.

type DocString

type DocString struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// MediaType of the documentation.
	// Example: text/plain;charset=UTF-8.
	// More details: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
	MediaType string `json:"MediaType,omitempty"`
	// Content of the documentation.
	Content string `json:"Content"`
	// Delimeter that is used.
	Delimiter string `json:"Delimiter"`
}

DocString is a gherkin's docString.

func (*DocString) From

func (to *DocString) From(from *messages.DocString) *DocString

From converts to DocString.

type Examples

type Examples struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// Tags provides a way of organizing blocks.
	Tags []*Tag `json:"Tags"`
	// Keyword of the block.
	Keyword string `json:"Keyword"`
	// Name of the block.
	Name string `json:"Name"`
	// Description of the block.
	Description string `json:"Description"`
	// ID is a unique identifier of the block.
	ID string `json:"ID"`

	// TableHeader contains a header of a table example.
	TableHeader *TableRow `json:"TableHeader,omitempty"`
	// TableBody contains a body of a table example.
	TableBody []*TableRow `json:"TableBody"`
}

Examples is a gherkin's examples.

func (*Examples) From

func (to *Examples) From(from *messages.Examples) *Examples

From converts to Examples.

type ExamplesSlice

type ExamplesSlice []*Examples

ExamplesSlice is a slice of examples.

func (ExamplesSlice) From

func (to ExamplesSlice) From(from []*messages.Examples) ExamplesSlice

From converts to ExamplesSlice.

type Feature

type Feature struct {
	// Location of a block in the document.
	// Location in the source.
	Location *Location `json:"Location"`
	// Tags provides a way of organizing blocks.
	Tags []*Tag `json:"Tags"`
	// Language of the document.
	// More details: https://cucumber.io/docs/gherkin/reference/#spoken-languages
	Language string `json:"Language"`
	// Keyword is always "Feature".
	// Keyword of the block.
	Keyword string `json:"Keyword"`
	// Name is a text of the feature.
	// Name of the block.
	Name string `json:"Name"`
	// Descriptions contains additional information about the feature.
	// Description of the block.
	Description string `json:"Description"`
	// Children elements of the feature.
	Children []*FeatureChild `json:"Children"`
	// contains filtered or unexported fields
}

Feature is a root element of the document.

The purpose of the Feature keyword is to provide a high-level description of a software feature, and to group related scenarios.

The first primary keyword in a Gherkin document must always be Feature, followed by a : and a short text that describes the feature.

More details: https://cucumber.io/docs/gherkin/reference/#feature

func (*Feature) From

func (to *Feature) From(from *messages.Feature) *Feature

From converts to Feature.

type FeatureChild

type FeatureChild struct {
	// Rule for the feature.
	Rule *Rule `json:"Rule,omitempty"`
	// Background for the feature.
	Background *Background `json:"Background,omitempty"`
	// Scenario for the feature.
	Scenario *Scenario `json:"Scenario,omitempty"`
}

FeatureChild is a gherkin's featureChild.

func (*FeatureChild) From

func (to *FeatureChild) From(from *messages.FeatureChild) *FeatureChild

From converts to FeatureChild.

type FeatureChildrenSlice

type FeatureChildrenSlice []*FeatureChild

FeatureChildrenSlice is a slice of featureChildren.

func (FeatureChildrenSlice) From

func (to FeatureChildrenSlice) From(from []*messages.FeatureChild) FeatureChildrenSlice

From converts to FeatureChildrenSlice.

type Format

type Format string

Format of the output.

const (
	FormatJSON Format = "json"
	FormatGo   Format = "go"
	FormatRaw  Format = "raw"
)

Possible formats.

type GenerateArgs

type GenerateArgs struct {
	Format         Format
	InputSource    []byte
	TemplateSource []byte
	PackageName    string
}

GenerateArgs contains required arguments for generate.

type GherkinDocument

type GherkinDocument struct {
	URI string `json:"URI,omitempty"`
	// Feature is a root element of the document.
	Feature *Feature `json:"Feature,omitempty"`
	// Comments to the feature.
	Comments []*Comment `json:"Comments"`
}

GherkinDocument is a core document.

More details: https://cucumber.io/docs/cucumber/

func (*GherkinDocument) From

func (to *GherkinDocument) From(from *messages.GherkinDocument) *GherkinDocument

From converts to GherkinDocument.

type Location

type Location struct {
	// Column of the parent element.
	Line int64 `json:"Line"`
	// Column of the parent element.
	Column int64 `json:"Column,omitempty"`
}

Location is a gherkin's location.

func (*Location) From

func (to *Location) From(from *messages.Location) *Location

From converts to Location. Location in the source.

type Rule

type Rule struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// Tags provides a way of organizing blocks.
	Tags []*Tag `json:"Tags"`
	// Keyword of the block.
	Keyword string `json:"Keyword"`
	// Name of the block.
	Name string `json:"Name"`
	// Description of the block.
	Description string `json:"Description"`
	// Children of the rule.
	Children []*RuleChild `json:"Children"`
	// ID is a unique identifier of the block.
	ID string `json:"ID"`
	// contains filtered or unexported fields
}

Rule is a gherkin's rule.

func (*Rule) From

func (to *Rule) From(from *messages.Rule) *Rule

From converts to Rule.

type RuleChild

type RuleChild struct {
	// Background of the rule.
	Background *Background `json:"Background,omitempty"`
	// Scenration of the rule.
	Scenario *Scenario `json:"Scenario,omitempty"`
}

RuleChild is a gherkin's ruleChild.

func (*RuleChild) From

func (to *RuleChild) From(from *messages.RuleChild) *RuleChild

From converts to RuleChild.

type RuleChildSlice

type RuleChildSlice []*RuleChild

RuleChildSlice is a slice of ruleChild.

func (RuleChildSlice) From

func (to RuleChildSlice) From(from []*messages.RuleChild) RuleChildSlice

From converts to RuleChildSlice.

type Scenario

type Scenario struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// Tags provides a way of organizing blocks.
	Tags []*Tag `json:"Tags"`
	// Keyword of the block.
	Keyword string `json:"Keyword"`
	// Name of the block.
	Name string `json:"Name"`
	// Description of the block.
	Description string `json:"Description"`
	// Steps of the scenario.
	Steps []*Step `json:"Steps"`
	// Examples of the scenario.
	Examples []*Examples `json:"Examples"`
	// ID is a unique identifier of the block.
	ID string `json:"ID"`
	// contains filtered or unexported fields
}

Scenario is a gherkin's scenario.

func (*Scenario) From

func (to *Scenario) From(from *messages.Scenario) *Scenario

From converts to Scenario.

type Step

type Step struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// Keyword can be one of: Given, When, Then, And, or But.
	// Keyword of the block.
	Keyword string `json:"Keyword"`
	// Text of the block.
	Text string `json:"Text"`
	// DocString is a documentation of the step.
	DocString *DocString `json:"DocString,omitempty"`
	// DataTable contains an example of the step.
	DataTable *DataTable `json:"DataTable,omitempty"`
	// ID is a unique identifier of the block.
	ID string `json:"ID"`
	// contains filtered or unexported fields
}

Step is a gherkin's step.

func (*Step) From

func (to *Step) From(from *messages.Step) *Step

From converts to Step.

type StepsSlice

type StepsSlice []*Step

StepsSlice is a slice of steps.

func (StepsSlice) From

func (to StepsSlice) From(from []*messages.Step) StepsSlice

From converts to StepsSlice.

type TableCell

type TableCell struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// Value of the cell.
	Value string `json:"Value"`
	// contains filtered or unexported fields
}

TableCell is a gherkin's tableCell.

func (*TableCell) From

func (to *TableCell) From(from *messages.TableCell, gt goType, ignoreGoTypes bool) *TableCell

From converts to TableCell.

type TableCellSlice

type TableCellSlice []*TableCell

TableCellSlice is a slice of tableCell.

func (TableCellSlice) From

func (to TableCellSlice) From(from []*messages.TableCell, goTypes []goType, ignoreGoTypes bool) TableCellSlice

From converts to TableCellSlice.

type TableRow

type TableRow struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// Cells contains example cells.
	Cells []*TableCell `json:"Cells"`
	// ID is a unique identifier of the block.
	ID string `json:"ID"`
	// contains filtered or unexported fields
}

TableRow is a row of the example.

func (*TableRow) From

func (to *TableRow) From(from *messages.TableRow, goTypes []goType, ignoreGoTypes bool) *TableRow

From converts to TableRow.

type TableRowSlice

type TableRowSlice []*TableRow

TableRowSlice is a slice of tableRow.

func (TableRowSlice) From

func (to TableRowSlice) From(from []*messages.TableRow) TableRowSlice

From converts to TableRowSlice.

type Tag

type Tag struct {
	// Location in the source.
	Location *Location `json:"Location"`
	// Name of the block.
	Name string `json:"Name"`
	// ID is a unique identifier of the block.
	ID string `json:"ID"`
}

Tag is a gherkin's tag.

func (*Tag) From

func (to *Tag) From(from *messages.Tag) *Tag

From converts to Tag.

type TagsSlice

type TagsSlice []*Tag

TagsSlice is a slice of tags.

func (TagsSlice) From

func (to TagsSlice) From(from []*messages.Tag) TagsSlice

From converts to TagsSlice.

type TemplateData

type TemplateData struct {
	*GherkinDocument
	PackageName string `json:"PackageName"`
}

TemplateData contains root arguments for template.

Jump to

Keyboard shortcuts

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