Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/helloticket/go-dbunit
Library for integration tests
https://github.com/helloticket/go-dbunit
golang library
Last synced: about 1 month ago
JSON representation
Library for integration tests
- Host: GitHub
- URL: https://github.com/helloticket/go-dbunit
- Owner: helloticket
- License: mit
- Created: 2019-06-07T16:55:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T00:53:09.000Z (almost 2 years ago)
- Last Synced: 2024-06-20T09:11:12.190Z (7 months ago)
- Topics: golang, library
- Language: Go
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-dbunit
go-dbunit is a extension targeted at database-driven projects inspired by dbunit for java and go-testfixtures.
## Using
```bash
import "github.com/helloticket/go-dbunit"db, err := sql.Open("postgres", ds)
if err != nil {
log.Fatalf("Failed to connect to database: %v\n", err)
}dbFactory := dbunit.NewPostgresDatabaseFactory(db)
dataSet := dbunit.NewFlatYmlDataSet("testdata/fixtures")
dbunit.DeleteAndInsert(dbFactory, dataSet).Execute("posts.yml")
```## Test (for only suite test go-dbunit)
```bash
docker run --rm -p 5454:5432 -e POSTGRES_USER=dbunit -e POSTGRES_PASSWORD=dbunit00 postgres:9.6
```## Inspired
- http://dbunit.sourceforge.net
- https://github.com/go-testfixtures/testfixtures