testtools

module
v0.1.0 Latest Latest
Warning

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

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

README

testtools

action status codecov

The package provides some test tools in Golang programming.

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

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
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
tests

Jump to

Keyboard shortcuts

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