automatic golden testing for HTTP interactions in Go via .har files
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Watney Build Status codecov

A port of the Ruby vcr library to Go, backed by

Run tests that depend on the network, reliably, without ever touching the network itself.

Consider this package WIP - Pull Requests / Issues are greatly appreciated while the exact API is worked out :)


watney provides a http.RoundTripper that is automatically configured to use fixtures unless -watney is set in the test flag.

First record fixtures using go test -watney -v ./..., then replay them by omitting -watney in your future test runs.

To record a single test, use go test -watney -v -run CaseName and a new .har will be written.

Bonus! You can inspect any .har individually, with any number of tools, such as HAR Viewer, or Har Viewer

func TestGoogle(t *testing.T) {
	// you can use your own transport here, it is fully preserved during
	// recording
	tr := watney.Configure(http.DefaultTransport, t)

	c := &http.Client{
		Transport: tr,

	// writes to a file like watney_test.go.har
	defer watney.Save(c)

	resp, err := c.Get("")
	if err != nil {

	// test some things about resp

	defer resp.Body.Close()


Originally derived from a helper I found in, which is MIT licensed. The same license applies here