Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ropensci/vcr

Record HTTP calls and replay them
https://github.com/ropensci/vcr

mocking r r-package rstats testing unit-testing vcr

Last synced: 3 months ago
JSON representation

Record HTTP calls and replay them

Awesome Lists containing this project

README

        

---
output: github_document
---

vcr
===

```{r echo=FALSE}
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
warning = FALSE,
message = FALSE
)
```

[![cran checks](https://badges.cranchecks.info/worst/vcr.svg)](https://cloud.r-project.org/web/checks/check_results_vcr.html)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![R-check](https://github.com/ropensci/vcr/workflows/R-check/badge.svg)](https://github.com/ropensci/vcr/actions/)
[![codecov](https://codecov.io/gh/ropensci/vcr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ropensci/vcr)
[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/vcr)](https://github.com/r-hub/cranlogs.app)
[![cran version](https://www.r-pkg.org/badges/version/vcr)](https://cran.r-project.org/package=vcr)

Easier HTTP testing! Record HTTP requests and responses on disk and replay them for the unit tests of your R package, to make them independent from any connection, faster, and more complete. An R port of the Ruby gem [vcr](https://github.com/vcr/vcr)

## Elevator pitch

```{r child='man/rmdhunks/elevator-pitch.Rmd'}
```

## Installation

CRAN version:

```{r eval=FALSE}
install.packages("vcr")
```

Development version:

```{r eval=FALSE}
# install.packages("pak")
pak::pak("ropensci/vcr")
```

```{r}
library("vcr")
library("crul")
```

## Docs

Check out the [HTTP testing book](https://books.ropensci.org/http-testing/) and the [vcr vignettes](https://docs.ropensci.org/vcr/articles/).

## Supported HTTP libraries

* [crul][]
* [httr](https://httr.r-lib.org/)
* [httr2](https://httr2.r-lib.org/)

## Getting Started

```{r child='man/rmdhunks/setup.Rmd'}
```

## Usage

```{r child='man/rmdhunks/basic-usage.Rmd'}
```

## Terminology

```{r child='man/rmdhunks/glossary.Rmd'}
```

## Workflows

```{r child='man/rmdhunks/workflows.Rmd'}
```

### How it works in lots of detail

See the [vignette about internals](https://docs.ropensci.org/vcr/articles/internals.html)

### Just want to mock and not store on disk?

You're looking for [webmockr][], that vcr itself uses.
`webmockr` only matches requests based on criteria you choose, but does not cache HTTP interactions to disk as `vcr` does.

## Configuration

```{r child='man/rmdhunks/configuration.Rmd'}
```

## Matching/Matchers

```{r child='man/rmdhunks/matching.Rmd'}
```

## vcr in other languages

The canonical `vcr` (in Ruby) lists ports in other languages at

## Note about missing features

```{r child='man/rmdhunks/missing-features.Rmd'}
```

## Example packages using vcr

* [allcontributors][]
* [bold][]
* [qualtRics][]
* [rgbif][]
* [ritis][]
* [rredlist][]
* [rtoot][]
* [rtweet][]
* [wikitaxa][]
* [worrms][]

## Contributors

* [Scott Chamberlain](https://github.com/sckott)
* [Aaron Wolen](https://github.com/aaronwolen)
* [Maëlle Salmon](https://github.com/maelle)
* [Daniel Possenriede](https://github.com/dpprdan)

## Meta

* Please [report any issues or bugs](https://github.com/ropensci/vcr/issues)
* License: MIT
* Get citation information for `vcr` in R doing `citation(package = 'vcr')`
* Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms.

[allcontributors]: https://github.com/ropenscilabs/allcontributors
[bold]: https://github.com/ropensci/bold
[crul]: https://docs.ropensci.org/crul/
[qualtRics]: https://github.com/ropensci/qualtRics
[rgbif]: https://github.com/ropensci/rgbif
[ritis]: https://github.com/ropensci/ritis
[rredlist]: https://github.com/ropensci/rredlist
[rtoot]: https://github.com/gesistsa/rtoot
[rtweet]: https://github.com/ropensci/rtweet
[webmockr]: https://docs.ropensci.org/webmockr/
[wikitaxa]: https://github.com/ropensci/wikitaxa
[worrms]: https://github.com/ropensci/worrms