unbrokenwing

package
Version: v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package unbrokenwing provides help methods used by test-code generated by unbrokenwing command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func And

func And(step string, do func(Args) error) (err error)

And are used to map scenario steps with behaviours, this is mapped by matching regular expression in first argument against scenario step in Gherkin language.

func But

func But(step string, do func(Args) error) (err error)

But are used to map scenario steps with behaviours, this is mapped by matching regular expression in first argument against scenario step in Gherkin language.

func Failure

func Failure(reason string) error

Failure returns error that are suitable to be returned from behaviour descriptions that failes during test.

func Given

func Given(step string, do func(Args) error) (err error)

Given are used to map scenario steps with behaviours, this is mapped by matching regular expression in first argument against scenario step in Gherkin language.

func NotImplemented

func NotImplemented(t Step) error

NotImplemented returns error that are suitable to be returned when unbrokenwings driver are not able to find matching behaviour implementation.

func Pending

func Pending(reason string) error

Pending returns error that are suitable to be returned from behaviour descriptions that are generated but not implemented yet.

func Then

func Then(step string, do func(Args) error) (err error)

Then are used to map scenario steps with behaviours, this is mapped by matching regular expression in first argument against scenario step in Gherkin language.

func When

func When(step string, do func(Args) error) (err error)

When are used to map scenario steps with behaviours, this is mapped by matching regular expression in first argument against scenario step in Gherkin language.

Types

type Args

type Args map[string]string

Args provides data structure for arguments supplied to the step definition.

type FailureError

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

FailureError are suitable to be returned from behaviour descriptions that failes during test.

func (FailureError) Error

func (e FailureError) Error() string

type Feature

type Feature struct {
	Name        string
	Description string
	Scenarios   []Scenario
}

Feature contains data structure matching features in Gherkin. Each Scenario in Scenarios contains Description and scenario steps according to Gherkin scenarios.

func NewFeature

func NewFeature(reader io.Reader) (feature *Feature)

NewFeature scans FeatureFile for lines starting with "Feature:" followed by feature name, description and different scenarios. All scenarios including description are then returned as a Feature.

func (Feature) String

func (feature Feature) String() string

type NotImplError

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

NotImplError are suitable to be returned when unbrokenwings driver are not able to find matching behaviour implementation.

func (NotImplError) Error

func (e NotImplError) Error() string

type PendingError

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

PendingError are suitable to be returned from behaviour descriptions that are generated but not implemented yet.

func (PendingError) Error

func (e PendingError) Error() string

type Scenario

type Scenario struct {
	Description string
	Steps       []Step
}

Scenario contains data structure matching scenarios in Gherkin. Description holds all text from scenario line till first scenario step.

func (Scenario) String

func (scenario Scenario) String() string

type Step

type Step struct {
	Cmd         string
	Description string
}

Step corresponds to the a function related to a Given, When and Then-step.

Cmd correspons to one of following commands: Given, When, Then, But, And Description contains the rest of the text that follows after the command.

func (Step) String

func (step Step) String() string

String returns the original text before broken down to cmd and description.

type Suite

type Suite interface {
	String() string
	Test(feature Feature, t *testing.T) error
}

Suite interface provides measures to run feature and record test result. Test results are based on bahaviours supplied by one of following commands: Given, When, Then, But, And, Asterix. String function returns test result as string, suitable to be printed to stdout.

func NewSuite

func NewSuite() Suite

NewSuite generates built-in Suite implementation.

Jump to

Keyboard shortcuts

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