testspecs

package
v0.0.0-...-317aa01 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestFilePath          = "templates/test_output_spec.tmpl"
	FrameworkDescribePath = "templates/framework_describe_func.tmpl"

	SpecsPath = "templates/specs.tmpl"
)

Variables

This section is empty.

Functions

func RenderFrameworkDescribeGoFile

func RenderFrameworkDescribeGoFile(t TemplateData) error

Types

type GinkgosSpecTranslator

type GinkgosSpecTranslator struct {
}

func NewGinkgoSpecTranslator

func NewGinkgoSpecTranslator() *GinkgosSpecTranslator

New returns a Ginkgo Spec Translator

func (*GinkgosSpecTranslator) FromFile

func (gst *GinkgosSpecTranslator) FromFile(file string) (TestOutline, error)

FromFile generates a TestOutline from a Ginkgo test File

func (*GinkgosSpecTranslator) ToFile

func (gst *GinkgosSpecTranslator) ToFile(destination, teamTmplPath string, outline TestOutline) error

ToFile generates a Ginkgo test file from a TestOutline

type TemplateData

type TemplateData struct {
	Outline                 TestOutline
	PackageName             string
	FrameworkDescribeString string
}

func NewTemplateData

func NewTemplateData(specOutline TestOutline, destination string) *TemplateData

type TestOutline

type TestOutline []TestSpecNode

func (*TestOutline) ToString

func (to *TestOutline) ToString() string

type TestSpecNode

type TestSpecNode struct {
	Name                 string
	Text                 string
	Labels               []string
	Nodes                TestOutline
	InnerParentContainer bool
	LineSpaceLevel       int
}

I've modeled this based on Ginkgo's model used by the outline command but it is much simpler and tailored to our BDD Test Spec and Test Outline concepts

func ExtractFrameworkDescribeNode

func ExtractFrameworkDescribeNode(filename string) (TestSpecNode, error)

ExtractFrameworkDescribeNode will return a TestSpecNode

type TextSpecTranslator

type TextSpecTranslator struct {
}

func NewTextSpecTranslator

func NewTextSpecTranslator() *TextSpecTranslator

New returns a Ginkgo Spec Translator

func (*TextSpecTranslator) FromFile

func (tst *TextSpecTranslator) FromFile(file string) (TestOutline, error)

FromFile generates a TestOutline from a Text outline File

func (*TextSpecTranslator) ToFile

func (tst *TextSpecTranslator) ToFile(destination string, outline TestOutline) error

ToFile generates a Text outline file from a TestOutline

type Translator

type Translator interface {
	FromFile(file string) (TestOutline, error)
	ToFile(destination string, outline TestOutline) error
}

Jump to

Keyboard shortcuts

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