A Ruby library that records HTTP interactions and replays them for fast, deterministic tests.
VCR is a Ruby gem that records HTTP requests and responses during test runs and saves them as 'cassettes' for future replay. It solves the problem of slow, flaky tests that depend on external web services by eliminating real network calls, making tests fast, deterministic, and accurate. Developers use it to isolate their test suites from network conditions and third-party service availability.
Ruby developers writing tests for applications that make HTTP requests to external APIs or web services, especially those using RSpec, Cucumber, Test::Unit, or Minitest.
VCR is the de facto standard for HTTP recording in Ruby because of its extensive library support, simple configuration, and robust cassette management. It offers a unique balance of ease-of-use and flexibility, allowing precise control over request matching and response replay without sacrificing test realism.
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, 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.
Integrates with WebMock, Typhoeus, Faraday, Excon, and supports libraries like Net::HTTP, Mechanize, and HTTParty, making it versatile for most Ruby HTTP clients.
Records HTTP interactions with minimal setup code, as shown in the simple configuration example, and replays them for fast, deterministic tests.
Cassettes are stored in YAML or JSON, support ERB for dynamic responses, and allow different responses per test, providing fine-grained control over test data.
Includes configuration options to filter sensitive information like API keys from recorded cassettes, keeping test data secure, as mentioned in the documentation link.
The README explicitly states 'Help Wanted' for maintainers, indicating potential delays in updates and support, which could be a risk for long-term projects.
Static cassette recordings can become outdated if external APIs change, requiring manual re-recording or configuration for automatic updates, which adds maintenance burden.
While basic setup is simple, integrating with specific HTTP libraries or configuring custom matchers can be complex, as evidenced by the extensive documentation and dependency on stubbing libraries like WebMock.