Skip to content

Test toolkit for simplify the development of tests on Go

License

Notifications You must be signed in to change notification settings

partyzanex/testutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

testutils

Test toolkit for simplify the development of tests on Go

This package contains universal interfaces and utilities for handling errors in tests and benchmarks

Example

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

About

Test toolkit for simplify the development of tests on Go

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages