8000 GitHub - helloticket/go-dbunit: Library for integration tests
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

helloticket/go-dbunit

Repository files navigation

go-dbunit

go-dbunit is a extension targeted at database-driven projects inspired by dbunit for java and go-testfixtures.

Using

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)

docker run --rm -p 5454:5432 -e POSTGRES_USER=dbunit -e POSTGRES_PASSWORD=dbunit00 postgres:9.6

Inspired

About

Library for integration tests

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0