No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
auditor
deps
pkg/httputil
posts
Gopkg.lock
Gopkg.toml
README.md
main.go
mocking_go

README.md

Testing Go

This repo supports a blog post on testing in go.

It demonstrates two approaches to testing with third parties in go. The first is using an interface where a mocked and real implementation are used interchangably. Tests that don't really care about the behaviour of the third party can use the mock and forget about it. This approach can be found in posts/posts_test.go

The second approach is for when you want to test your third party client directly. It makes use of httptest.NewServer to create a test server to make requests against. This approach can be found in auditor/auditior_test.go

You can run the app with go run main.go or the tests with go test ./...