A Go library for recording and replaying HTTP interactions to create fast, deterministic tests.
go-vcr is a Go library that records HTTP interactions during tests and replays them in subsequent runs. It solves the problem of flaky, slow tests that depend on external APIs by providing deterministic, fast test execution with recorded fixtures.
Go developers writing integration tests that involve HTTP calls to external services, such as API clients or microservices.
Developers choose go-vcr because it eliminates network dependencies in tests, ensures test consistency, and speeds up test suites while providing flexibility through custom matchers and hooks for complex scenarios.
Record and replay your HTTP interactions for fast, deterministic and accurate tests
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Replays recorded HTTP interactions to eliminate flaky tests caused by network variability, ensuring consistent results across runs as highlighted in the README's philosophy.
Allows defining custom matcher functions to precisely control how requests are matched against cassettes, handling complex scenarios like body comparisons.
Hooks like BeforeSaveHook enable redacting sensitive information from cassettes before storage, protecting credentials as demonstrated in the README examples.
Supports recording incoming HTTP interactions for server handlers via HTTPMiddleware, facilitating comprehensive regression tests for application endpoints.
Cassettes can become outdated when external APIs change, requiring manual updates or re-recording, which adds to test maintenance overhead.
Primarily supports standard HTTP/1.x interactions and lacks native support for newer protocols like HTTP/2 or WebSockets, restricting use in modern applications.
Major version updates often necessitate recreating cassettes, as noted in the README's migration note, potentially disrupting test suites and workflows.