gdtfixtures

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gdt-fixtures - The Go Declarative Testing framework - Fixtures library go test workflow

gdt is a testing library that allows test authors to cleanly describe tests in a YAML file. gdt reads YAML files that describe a test's assertions and then builds a set of Go structures that the standard Go testing package can execute.

gdt-fixtures is a companion Go library for gdt that contains commonly-used test fixtures.

Installation

gdt-fixtures is a Go library and is intended to be included in your own Go application's test code as a Go package dependency.

Install gdt-fixtures into your $GOPATH by executing:

go get -u github.com/jaypipes/gdt-fixtures

Alternately, include github.com/jaypipes/gdt-fixtures in your Go dependency management of choice.

Introduction

TODO

Writing new gdt Fixtures

TODO

Contributing and acknowledgements

gdt was inspired by Gabbi, the excellent Python declarative testing framework. gdt tries to bring the same clear, concise test definitions to the world of Go functional testing.

Contributions to gdt-fixtures are welcomed! Feel free to open a Github issue or submit a pull request.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adapt

func Adapt(opts ...*WithOption) gdt.Fixture

Adapt returns a simple object that implements the interfaces.Fixture interface from one or more WithOptions describing starter, stopper functions or a state map

func NewJSONFixture

func NewJSONFixture(r io.Reader) (gdt.Fixture, error)

NewJSONFixture takes an io.Reader and returns a new gdt.Fixture that can have its data queried via JSONPath

Types

type WithOption

type WithOption struct {
	Starter func()
	Stopper func()
	State   map[string]interface{}
}

func WithStart

func WithStart(starter func()) WithOption

WithStart allows a starter functor to be adapted into a fixture

func WithState

func WithState(state map[string]interface{}) WithOption

WithState allows a map of state key/values to be adapted into a fixture

func WithStop

func WithStop(stopper func()) WithOption

WithStop allows a stopper functor to be adapted into a fixture

Jump to

Keyboard shortcuts

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