https://github.com/partyzanex/testutils
Test toolkit for simplify the development of tests on Go
https://github.com/partyzanex/testutils
database-testing go golang testing testing-tools tests
Last synced: 27 days ago
JSON representation
Test toolkit for simplify the development of tests on Go
- Host: GitHub
- URL: https://github.com/partyzanex/testutils
- Owner: partyzanex
- License: mit
- Created: 2019-10-23T20:26:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-16T17:57:21.000Z (almost 5 years ago)
- Last Synced: 2023-08-12T06:59:23.487Z (over 2 years ago)
- Topics: database-testing, go, golang, testing, testing-tools, tests
- Language: Go
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```go
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:
```bash
export TEST_DSN="user=postgres password=password sslmode=disable dbname=testdb"
go test ./path/to/some -v
```