embedded-postgres alternatives and similar packages
Based on the "Testing Frameworks" category.
Alternatively, view embedded-postgres alternatives based on common mentions on social networks and blogs.
-
Looking for Maintainer
Selenium/Webdriver client for Go -
gocheck
A more advanced testing framework alternative to gotest. -
baloo
Expressive and versatile end-to-end HTTP API testing made easy. -
testfixtures
A helper for Rails' like test fixtures to test database applications. -
go-vcr
Record and replay your HTTP interactions for fast, deterministic and accurate tests -
gnomock
integration testing with real dependencies (database, cache, even Kubernetes or AWS) running in Docker, without mocks. -
goc
Goc is a comprehensive coverage testing system for The Go Programming Language. -
charlatan
Tool to generate fake interface implementations for tests. -
gotest.tools
A collection of packages to augment the go testing package and support common patterns. -
go-testdeep
Extremely flexible golang deep comparison, extends the go testing package -
GoSpec
BDD-style testing framework for the Go programming language. -
dbcleaner
Clean database for testing purpose, inspired by database_cleaner in Ruby -
wstest
A websocket client for unit-testing a websocket http.Handler. -
gospecify
This provides a BDD syntax for testing your Go code. It should be familiar to anybody who has used libraries such as rspec. -
testcase
Idiomatic testing framework for Behavior Driven Development. -
jsonassert
Package for verifying that your JSON payloads are serialized correctly. -
restit
A Go micro framework to help writing RESTful API integration test. -
covergates
Self-hosted code coverage report review and management service. -
assert
Basic Assertion Library used along side native go testing, with building blocks for custom assertions -
Hamcrest
fluent framework for declarative Matcher objects that, when applied to input values, produce self-describing results. -
go-hit
Hit is an http integration test framework written in golang. -
testsql
Generate test data from SQL files before testing and clear it after finished. -
schema
Quick and easy expression matching for JSON schemas used in requests and responses. -
gosuite
Brings lightweight test suites with setup/teardown facilities to testing by leveraging Go1.7's Subtests
Scout APM - Leading-edge performance monitoring starting at $39/month
Do you think we are missing an alternative of embedded-postgres or a related project?
README
embedded-postgres
Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test.
When testing this provides a higher level of confidence than using any in memory alternative. It also requires no other external dependencies outside of the Go build ecosystem.
Heavily inspired by Java projects zonkyio/embedded-postgres and opentable/otj-pg-embedded and reliant on the great work being done by zonkyio/embedded-postgres-binaries in order to fetch precompiled binaries from Maven.
Installation
embedded-postgres uses Go modules and as such can be referenced by release version for use as a library. Use the following to add the latest release to your project.
go get -u github.com/fergusstrange/embedded-postgres
How to use
This library aims to require as little configuration as possible, favouring overridable defaults
Configuration | Default Value |
---|---|
Username | postgres |
Password | postgres |
Database | postgres |
Version | 12.1.0 |
RuntimePath | $USER_HOME/.embedded-postgres-go/extracted |
Port | 5432 |
StartTimeout | 15 Seconds |
A single Postgres instance can be created, started and stopped as follows
postgres := embeddedpostgres.NewDatabase()
err := postgres.Start()
// Do test logic
err := postgres.Stop()
or with created with custom configuration
postgres := NewDatabase(DefaultConfig().
Username("beer").
Password("wine").
Database("gin").
Version(V12).
RuntimePath("/tmp").
Port(9876).
StartTimeout(45 * time.Second))
err := postgres.Start()
// Do test logic
err := postgres.Stop()
It should be noted that if postgres.Stop()
is not called then the child Postgres process will not be released and the caller will block.
Examples
There are a number of realistic representations of how to use this library in examples.
Credits
- Gopherize Me Thanks for the awesome logo template.
- zonkyio/embedded-postgres-binaries Without which the precompiled Postgres binaries would not exist for this to work.
Contributing
View the [contributing guide](CONTRIBUTING.md).