Categorygithub.com/helbing/testtools
repository
0.1.2
Repository: https://github.com/helbing/testtools.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

testtools

The package provides some test tools in Golang programming.

  • flow: to help you autoload env runners and run test cases.
  • envs: the set of any envirments you want up & down when testing.
    • Docker-Compose

Usage

func TestDemo(t *testing.T) {
    // Initial runner
    runner := dockercompose.New("./docker-compose.yml")
    // Run testcases
    flow.New(runner).
        Case("testcase1", func(t *testing.T) {
            // TODO
        }).
        Case("testcase2", func(t *testing.T) {
            // TODO
        }).
        Run(t)
}

Develop your env runner

You just need to implement the Runner interface.

// Runner is to setup the environment required for testing.
type Runner interface {
    // Up runner.
    Up(tb testing.TB) error

    // Down runner.
    Down(tb testing.TB) error
}

Thanks