Test toolkit for simplify the development of tests on Go
This package contains universal interfaces and utilities for handling errors in tests and benchmarks
package some_test
import (
"testing"
"time"
_ "github.com/go-sql-driver/mysql"
"github.com/partyzanex/testutils"
)
func TestSomeTestName(t *testing.T) {
// supported mysql and postgres
db := testutils.NewSqlDB(t, "postgres", "TEST_DSN")
rows, err := db.Query(`select id, name from tbl where dt > ?`, time.Now())
testutils.FatalErr(t, "db.Query", err)
// ...
}
Run:
export TEST_DSN="user=postgres password=password sslmode=disable dbname=testdb"
go test ./path/to/some -v