Record and replay HTTP interactions for Elixir, inspired by Ruby's VCR.
ExVCR is an Elixir library that records and replays HTTP interactions for testing purposes. It captures real network requests and responses, storing them as JSON cassettes that can be replayed later, eliminating external dependencies and making tests faster and more reliable. It is directly inspired by Ruby's VCR and supports multiple Elixir HTTP clients.
Elixir developers writing tests for applications that make HTTP requests, particularly those using libraries like HTTPoison, Finch, or ibrowse who need deterministic and offline-friendly test suites.
Developers choose ExVCR because it provides a straightforward way to mock HTTP interactions without manual stubbing, reduces test flakiness by removing network variability, and integrates seamlessly with existing Elixir test frameworks through a simple cassette-based API.
HTTP request/response recording library for elixir, inspired by VCR.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports popular Elixir HTTP clients like ibrowse, hackney, httpc, and Finch, as shown in the README's adapter examples, making it versatile for different project setups.
Includes built-in functions to filter sensitive data such as passwords and tokens from cassettes, using patterns and placeholders, which enhances security for stored test recordings.
Allows request matching based on URL, query parameters, request body, or custom matchers, providing precise control over how responses are replayed during tests.
Comes with mix tasks for cassette management—like listing, deleting, and checking usage—which simplifies maintenance and debugging of test suites.
The README admits ExVCR can be slow, with each use_cassette taking around 500 ms, potentially adding significant latency to test runs, especially in suites with many HTTP interactions.
Support for some HTTP clients like hackney and httpc is described as 'very limited' and only tested with specific functions, which may lead to issues in complex or edge-case scenarios.
Features like global mock are experimental and may not work reliably, as noted in the README with references to unresolved issues, adding risk for production use.