https://github.com/vcr/vcr
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
https://github.com/vcr/vcr
Keywords from Contributors
activerecord mvc activejob rubygems rack rspec rubocop authorization sinatra crash-reporting
Last synced: about 4 hours ago
JSON representation
Repository metadata
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
- Host: GitHub
- URL: https://github.com/vcr/vcr
- Owner: vcr
- License: other
- Created: 2010-02-25T07:16:00.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2026-03-19T07:43:43.000Z (14 days ago)
- Last Synced: 2026-03-24T22:00:37.839Z (8 days ago)
- Language: Ruby
- Homepage: https://benoittgt.github.io/vcr
- Size: 3.32 MB
- Stars: 6,041
- Watchers: 70
- Forks: 506
- Open Issues: 88
- Releases: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Maintainers: MAINTAINERS
README.md
vcr
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
Help Wanted
We're looking for more maintainers. If you'd like to help maintain a well-used gem please spend some time reviewing pull requests, issues, or participating in discussions.
Usage
Add the below to your spec_helper.rb file:
require 'rubygems'
require 'test/unit'
require 'vcr'
VCR.configure do |config|
config.cassette_library_dir = "fixtures/vcr_cassettes"
config.hook_into :webmock
end
class VCRTest < Test::Unit::TestCase
def test_example_dot_com
VCR.use_cassette("synopsis") do
response = Net::HTTP.get_response(URI('http://www.iana.org/domains/reserved'))
assert_match /Example domains/, response.body
end
end
end
Run this test once, and VCR will record the HTTP request to fixtures/vcr_cassettes/synopsis.yml. Run it again, and VCR will replay the response from iana.org when the HTTP request is made. This test is now fast (no real HTTP requests are made anymore), deterministic (the test will continue to pass, even if you are offline, or iana.org goes down for maintenance) and accurate (the response will contain the same headers and body you get from a real request). You can use a different cassette library directory (e.g., "test/vcr_cassettes").
NOTE: To avoid storing any sensitive information in cassettes, check out Filter Sensitive Data in the documentation.
Rails and Minitest:
Do not use 'test/fixtures' as the directory if you're using Rails and Minitest (Rails will instead transitively load any files in that directory as models).
Features
- Automatically records and replays your HTTP interactions with minimal setup/configuration code.
- Supports and works with the HTTP stubbing facilities of multiple libraries. Currently, the following are supported:
- Supports multiple HTTP libraries:
- Patron (when using WebMock)
- Curb (when using WebMock -- only supports Curl::Easy at the moment)
- HTTPClient (when using WebMock)
- em-http-request (when using WebMock)
- Net::HTTP (when using WebMock)
- Typhoeus (Typhoeus::Hydra, but not Typhoeus::Easy or Typhoeus::Multi)
- Excon
- Faraday
- And of course any library built on Net::HTTP, such as Mechanize, HTTParty or Rest Client.
- Request matching is configurable based on HTTP method, URI, host, path, body and headers, or you can easily implement a custom request matcher to handle any need.
- The same request can receive different responses in different tests--just use different cassettes.
- The recorded requests and responses are stored on disk in a serialization format of your choice (currently YAML and JSON are built in, and you can easily implement your own custom serializer) and can easily be inspected and edited.
- Dynamic responses are supported using ERB.
- Optionally re-records cassettes on a configurable regular interval to keep them fresh and current.
- Disables all HTTP requests that you don't explicitly allow.
- Simple Cucumber integration is provided using tags.
- Includes convenient RSpec macros and integration with RSpec 2 metadata.
- Known to work well with many popular Ruby libraries including RSpec 1 & 2, Cucumber, Test::Unit, Capybara, Mechanize, Rest Client and HTTParty.
- Includes Rack and Faraday middleware.
- Supports filtering sensitive data from the response body
The docs come in two flavors:
- The usage docs contain example-based documentation (VCR's Cucumber suite, in fact). It's a good place to look when you are first getting started with VCR, or if you want to see an example of how to use a feature.
- The rubydoc.info docs contain API documentation. The API docs contain detailed info about all of VCR's public API.
- See the CHANGELOG doc for info about what's new and changed.
There is also a Railscast (from 2011), which will get you up and running in no-time http://railscasts.com/episodes/291-testing-with-vcr.
Release Policy
VCR follows the principles of semantic versioning. The API documentation defines VCR's public API. Patch level releases contain only bug fixes. Minor releases contain backward-compatible new features. Major new releases contain backwards-incompatible changes to the public API.
Ruby Interpreter Compatibility
VCR versions 6.x are tested on the following ruby interpreters:
- MRI 3.3
- MRI 3.2
- MRI 3.1
- MRI 3.0
- MRI 2.7
- MRI 2.6
VCR 6.0.0 is the last version supporting >= 2.3.
VCR 6.1.0 is the last version supporting >= 2.6.
Upcoming releases will only explicitly support >= 2.7.
Development
- Source hosted on GitHub.
- Direct questions and discussions on GitHub Issues.
- Report bugs/issues on GitHub Issues.
- Pull requests are very welcome! Please include spec and/or feature coverage for every patch,
and create a topic branch for every separate change you make. - See the Contributing
guide for instructions on running the specs and features. - Code quality metrics are checked by Code Climate.
- Documentation is generated with YARD (cheat sheet).
To generate while developing:
yard server --reload
Ports in Other Languages
- Betamax (Python)
- VCR.py (Python)
- Betamax (Go)
- DVR (Go)
- Go VCR (Go)
- vcr-clj (Clojure)
- scotch (C#/.NET)
- Betamax.NET (C#/.NET)
- Vcr.HttpRecorder (C#/.NET)
- ExVCR (Elixir)
- VCR (Haskell)
- Mimic (PHP/Kohana)
- PHP-VCR (PHP)
- Talkback (JavaScript/Node)
- NSURLConnectionVCR (Objective-C)
- VCRURLConnection (Objective-C)
- DVR (Swift)
- VHS (Erlang)
- Betamax (Java)
- http_replayer (Rust)
- OkReplay (Java/Android)
- vcr (R)
- hi8.cr (Crystal)
- eighttrack (Crystal)
- VCR (Crystal fork)
Related Projects
- Mr. Video (Rails engine for managing VCR cassettes and episodes)
Similar Libraries in Ruby
Credits
- Aslak Hellesøy for Cucumber.
- Bartosz Blimke for WebMock.
- Chris Kampmeier for FakeWeb.
- Chris Young for NetRecorder,
the inspiration for VCR. - David Balatero and Hans Hasselberg
for help with Typhoeus support. - Wesley Beary for help with Excon
support. - Jacob Green for help with ongoing VCR
maintenance. - Jan Berdajs and Daniel Berger
for improvements to thread-safety.
Thanks also to the following people who have contributed patches or helpful suggestions:
- Aaron Brethorst
- Alexander Wenzowski
- Austen Ito
- Avdi Grimm
- Bartosz Blimke
- Benjamin Oakes
- Ben Hutton
- Bradley Isotope
- Carlos Kirkconnell
- Chad Jolly
- Chris Le
- Chris Gunther
- Eduardo Maia
- Eric Allam
- Ezekiel Templin
- Flaviu Simihaian
- Gordon Wilson
- Hans Hasselberg
- Herman Verschooten
- Ian Cordasco
- Ingemar
- Ilya Scharrenbroich
- Jacob Green
- James Bence
- Jay Shepherd
- Jeff Pollard
- Joe Nelson
- Jonathan Tron
- Justin Smestad
- Karl Baum
- Kris Luminar
- Kurt Funai
- Luke van der Hoeven
- Mark Burns
- Max Riveiro
- Michael Lavrisha
- Michiel de Mare
- Mike Dalton
- Mislav Marohnić
- Nathaniel Bibler
- Noah Davis
- Oliver Searle-Barnes
- Omer Rauchwerger
- Paco Guzmán
- Paul Morgan
- playupchris
- Ron Smith
- Ryan Bates
- Ryan Burrows
- Ryan Castillo
- Sathya Sekaran
- Scott Carleton
- Shay Frendt
- Steve Faulkner
- Stephen Anderson
- Todd Lunter
- Tyler Hunt
- Uģis Ozols
- vzvu3k6k
- Wesley Beary
Backers
Support us with a monthly donation and help us continue our activities. [Become a backer]
Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]
Owner metadata
- Name: VCR
- Login: vcr
- Email:
- Kind: organization
- Description: The collection of libraries for the Network Communication Persistence Protocol
- Website: https://www.ncpp.com
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/2902977?v=4
- Repositories: 1
- Last ynced at: 2024-03-25T18:48:12.918Z
- Profile URL: https://github.com/vcr
GitHub Events
Total
- Delete event: 2
- Pull request event: 19
- Fork event: 17
- Issues event: 19
- Watch event: 168
- Issue comment event: 32
- Push event: 12
- Pull request review comment event: 3
- Pull request review event: 13
- Create event: 1
Last Year
- Delete event: 2
- Pull request event: 13
- Fork event: 10
- Issues event: 7
- Watch event: 71
- Issue comment event: 13
- Push event: 10
- Pull request review comment event: 3
- Pull request review event: 11
- Create event: 1
Committers metadata
Last synced: 3 days ago
Total Commits: 1,986
Total Committers: 189
Avg Commits per committer: 10.508
Development Distribution Score (DDS): 0.255
Commits in past year: 15
Committers in past year: 13
Avg Commits per committer in past year: 1.154
Development Distribution Score (DDS) in past year: 0.867
| Name | Commits | |
|---|---|---|
| Myron Marston | m****n@g****m | 1480 |
| Mislav Marohnić | m****c@g****m | 66 |
| Olle Jonsson | o****n@g****m | 42 |
| Kurtis Rainbolt-Greene | me@k****e | 39 |
| Tony Miller | m****l@g****m | 28 |
| Kurtis Rainbolt-Greene | k****s@r****e | 21 |
| Nathaniel Bibler | g****t@n****m | 15 |
| Jacob Green | j****b@n****m | 10 |
| Jan Berdajs | m****o@g****m | 10 |
| André Luis Leal Cardoso Jr | a****r@g****m | 9 |
| Luke van der Hoeven | h****t@g****m | 7 |
| Ivan Kapelyukhin | i****n@s****m | 6 |
| Ryan Foster | r****r@v****m | 5 |
| Alexander Wenzowski | a****r@w****m | 4 |
| Ben Lavender | b****a@g****m | 4 |
| Chris Gunther | c****s@r****m | 4 |
| Jean byroot Boussier | j****b@s****m | 4 |
| hirowatari | K****n@h****a | 4 |
| Ian Cordasco | g****v@g****m | 3 |
| Jason Rylance | e****r@g****m | 3 |
| Leon Miller-Out | l****n@s****m | 3 |
| Mattias Putman | m****n@g****m | 3 |
| Mike Nicholaides | m****s@g****m | 3 |
| Nelli K | 7****x | 3 |
| Todd Lunter | t****r@g****m | 3 |
| Vladimir Kochnev | h****e@y****u | 3 |
| dependabot[bot] | 4****] | 3 |
| vzvu3k6k | v****k@g****m | 3 |
| Matt Brictson | m****t@m****m | 3 |
| Ryan Burrows | r****s@g****m | 3 |
| and 159 more... | ||
Committer domains:
- shopify.com: 3
- bendyworks.com: 2
- github.com: 2
- yandex.ru: 2
- hans.io: 1
- idaemons.org: 1
- digidentity.eu: 1
- shaicoleman.com: 1
- jovoto.com: 1
- playup.com: 1
- toptal.com: 1
- benjaminoakes.com: 1
- computer.org: 1
- dwheeler.com: 1
- zeisler.net: 1
- ent.io: 1
- turismoi.com: 1
- centro.net: 1
- plataformatec.com.br: 1
- kurtisrainboltgreene.name: 1
- rainbolt-greene.online: 1
- nathanielbibler.com: 1
- nationbuilder.com: 1
- suse.com: 1
- viget.com: 1
- wenzowski.com: 1
- room118solutions.com: 1
- hirowatari.ca: 1
- singlebrook.com: 1
- mattbrictson.com: 1
- artsicle.com: 1
- weblinc.com: 1
- spam.raszi.hu: 1
- sprucecreeksoftware.com: 1
- mdsol.com: 1
- weshop.us: 1
- tylerhunt.com: 1
- hawthorn.email: 1
- lostapathy.com: 1
- balvig.com: 1
- binarycode.ru: 1
- dabrow.org: 1
- verschooten.net: 1
- kde.org: 1
- casttv.com: 1
- steinitz.com: 1
- templ.in: 1
- mac.com: 1
- columbia.edu: 1
- nietzold.com: 1
- matijs.net: 1
- experimentslabs.com: 1
- bcs.io: 1
- tron.name: 1
- ama.ab.ca: 1
- agoragames.com: 1
- seerinteractive.com: 1
- isotope11.com: 1
- hedgeye.com: 1
- clio.com: 1
- typeful.net: 1
- gneoxsolutions.com: 1
- railscasts.com: 1
- pen.mn: 1
- sharpeleven.org: 1
- tessenow.org: 1
- ecraft.com: 1
- starkast.net: 1
- opsb.co.uk: 1
- goodlife.tw: 1
- xox.se: 1
- hashref.com: 1
Issue and Pull Request metadata
Last synced: 3 days ago
Total issues: 100
Total pull requests: 127
Average time to close issues: 11 months
Average time to close pull requests: 3 months
Total issue authors: 86
Total pull request authors: 51
Average comments per issue: 3.63
Average comments per pull request: 1.42
Merged pull request: 88
Bot issues: 0
Bot pull requests: 3
Past year issues: 9
Past year pull requests: 14
Past year average time to close issues: 2 months
Past year average time to close pull requests: about 1 month
Past year issue authors: 7
Past year pull request authors: 9
Past year average comments per issue: 0.78
Past year average comments per pull request: 0.71
Past year merged pull request: 8
Past year bot issues: 0
Past year bot pull requests: 2
Top Issue Authors
- olleolleolle (13)
- chrishough (2)
- mattbrictson (2)
- SirNerdBear (1)
- petergoldstein (1)
- fatkodima (1)
- A5308Y (1)
- ishan123456789 (1)
- AlanDonohoe (1)
- nathany (1)
- Fryguy (1)
- bolshoytoster (1)
- jasonfb (1)
- david-a-wheeler (1)
- FayeFang (1)
Top Pull Request Authors
- olleolleolle (32)
- andrehjr (14)
- mattbrictson (4)
- casperisfine (4)
- aka47 (3)
- dependabot[bot] (3)
- bradshjg (3)
- nellirx (3)
- BADASSMERGE (2)
- andrew (2)
- joaoGabriel55 (2)
- jamesmcguirepro (2)
- aglundahl (2)
- Earlopain (2)
- mark-young-atg (2)
Top Issue Labels
- enhancement (4)
- help wanted (4)
- bug (2)
- threadsafety (2)
- good first issue (2)
- question (1)
Top Pull Request Labels
- dependencies (3)
- enhancement (2)
- github_actions (2)
- faraday (1)
- bug (1)
Package metadata
- Total packages: 6
-
Total downloads:
- rubygems: 299,501,365 total
- Total docker downloads: 3,218,384,060
- Total dependent packages: 3,588 (may contain duplicates)
- Total dependent repositories: 30,936 (may contain duplicates)
- Total versions: 217
- Total maintainers: 5
gem.coop: vcr
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
- Homepage: https://benoittgt.github.io/vcr
- Documentation: http://www.rubydoc.info/gems/vcr/
- Licenses: Hippocratic-2.1,MIT
- Latest release: 6.4.0 (published 3 months ago)
- Last Synced: 2026-03-31T08:44:35.795Z (2 days ago)
- Versions: 72
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 149,759,217 Total
- Docker Downloads: 1,609,192,030
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.059%
- Docker downloads count: 0.062%
- Downloads: 0.173%
- Maintainers (4)
-
Funding:
- https://opencollective.com/vcr
rubygems.org: vcr
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
- Homepage: https://benoittgt.github.io/vcr
- Documentation: http://www.rubydoc.info/gems/vcr/
- Licenses: Hippocratic-2.1,MIT
- Latest release: 6.4.0 (published 3 months ago)
- Last Synced: 2026-03-31T02:00:35.313Z (2 days ago)
- Versions: 72
- Dependent Packages: 3,588
- Dependent Repositories: 30,935
- Downloads: 149,734,588 Total
- Docker Downloads: 1,609,192,030
-
Rankings:
- Dependent packages count: 0.014%
- Downloads: 0.168%
- Docker downloads count: 0.192%
- Dependent repos count: 0.196%
- Stargazers count: 0.203%
- Average: 0.332%
- Forks count: 1.219%
- Maintainers (4)
-
Funding:
- https://opencollective.com/vcr
proxy.golang.org: github.com/vcr/vcr
- Homepage:
- Documentation: https://pkg.go.dev/github.com/vcr/vcr#section-documentation
- Licenses: other
- Latest release: v6.4.0+incompatible (published 3 months ago)
- Last Synced: 2026-03-30T04:01:21.638Z (3 days ago)
- Versions: 70
- Dependent Packages: 0
- Dependent Repositories: 1
-
Rankings:
- Stargazers count: 0.883%
- Forks count: 1.292%
- Average: 4.112%
- Dependent repos count: 4.719%
- Dependent packages count: 9.553%
gem.coop: mustwin-vcr
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
- Homepage: http://vcr.github.io/vcr
- Documentation: http://www.rubydoc.info/gems/mustwin-vcr/
- Licenses: MIT
- Latest release: 2.9.3 (published about 11 years ago)
- Last Synced: 2026-03-30T04:01:20.037Z (3 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 3,780 Total
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 26.971%
- Downloads: 80.914%
- Maintainers (1)
rubygems.org: mustwin-vcr
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
- Homepage: http://vcr.github.io/vcr
- Documentation: http://www.rubydoc.info/gems/mustwin-vcr/
- Licenses: MIT
- Latest release: 2.9.3 (published about 11 years ago)
- Last Synced: 2026-03-30T04:01:20.018Z (3 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 3,780 Total
-
Rankings:
- Stargazers count: 0.184%
- Forks count: 1.106%
- Dependent packages count: 15.706%
- Average: 29.419%
- Dependent repos count: 46.782%
- Downloads: 83.315%
- Maintainers (1)
guix: ruby-vcr-expat
HTTP interaction recorder [old version]
- Homepage: https://github.com/vcr/vcr
- Documentation: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/ruby-xyz.scm#n9499
- Licenses: expat
- Latest release: 5.0.0-0.842b2bf (published about 1 month ago)
- Last Synced: 2026-03-02T18:59:31.793Z (about 1 month ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- curb ~> 0.9.0
- em-http-request >= 0
- faraday >= 0.9.2, < 2
- jruby-openssl >= 0
- patron = 0.6.3
- typhoeus ~> 1.1.0
- webrick >= 0
- aruba ~> 0.14.14 development
- bundler ~> 2.0 development
- codeclimate-test-reporter ~> 0.4 development
- cucumber ~> 7.0 development
- excon >= 0.62.0 development
- faraday >= 0.11.0, < 2.0.0 development
- hashdiff >= 1.0.0.beta1, < 2.0.0 development
- httpclient >= 0 development
- json >= 0 development
- mime-types >= 0 development
- pry ~> 0.9 development
- pry-doc ~> 0.6 development
- rack >= 0 development
- rake >= 12.3.3 development
- relish >= 0 development
- rspec ~> 3.0 development
- sinatra >= 0 development
- test-unit ~> 3.4.4 development
- timecop >= 0 development
- webmock >= 0 development
- yard >= 0 development
- actions/checkout v2 composite
- ruby/setup-ruby v1 composite
Score: 35.94366984943278