foxytest

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Test

type Test interface {
	Run(t TestRunner)
	SetLogging(bool)
	GetTestCases() []TestCase
}

type TestCase

type TestCase interface {
	GetName() string
	GetInputs() []map[string]interface{}
	GetOutputs() []map[string]interface{}
}

type TestRunner

type TestRunner interface {
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Log(args ...interface{})
	Logf(format string, args ...interface{})
	Run(name string, f func(t TestRunner)) bool
}

TestRunner is an interface that is compatible with the testing.T interface , so that the test suite can be run with the standard go test runner or with any other runner that implements this interface, particularly it is used by foxytest own command line runner allowing to use this test suite runner from languages other than Go

func NewTestRunner

func NewTestRunner(t *testing.T) TestRunner

type TestSuite

type TestSuite interface {
	WithBeforeAll(func() error) TestSuite
	WithAfterAll(func() error) TestSuite
	WithBeforeEach(func() error) TestSuite
	WithAfterEach(func() error) TestSuite
	WithLogging() TestSuite

	WithExecutable(command string, args []string) TestSuite

	Run(t TestRunner)
	Errors() []error
	AssertNoErrors(t TestRunner)
	GetTests() []Test
}

TestSuite represents a collection of tests that can be run together

func Read

func Read(path string) (TestSuite, error)

Read would read a collection of tests from a folder specified by path

Jump to

Keyboard shortcuts

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