testtools

module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: MIT

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

Directories

Path Synopsis
Package envs is the set of any environments you want to up & down when testing.
Package envs is the set of any environments you want to up & down when testing.
dockercompose
Package dockercompose is a runner to up & down environment through Docker-Compose.
Package dockercompose is a runner to up & down environment through Docker-Compose.
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package flow is to help autoload env runners and run test cases.
Package flow is to help autoload env runners and run test cases.
tests

Jump to

Keyboard shortcuts

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