Testing and documenting code that communicates with remote servers can be painful. Dealing with authentication, server state, and other complications can make testing seem too costly to bother with. But it doesn't need to be that hard. This package enables one to test all of the logic on the R sides of the API in your package without requiring access to the remote service. Importantly, it provides three contexts that mock the network connection in different ways, as well as testing functions to assert that HTTP requests were—or were not—made. It also allows one to safely record real API responses to use as test fixtures. The ability to save responses and load them offline also enables one to write vignettes and other dynamic documents that can be distributed without access to a live server.
Version: | 4.2.2 |
Depends: | R (≥ 3.5.0), testthat |
Imports: | curl, digest, httr, jsonlite, stats, utils |
Suggests: | knitr, pkgload, rmarkdown, spelling, xml2 |
Published: | 2024-01-23 |
DOI: | 10.32614/CRAN.package.httptest |
Author: | Neal Richardson [aut, cre], Jonathan Keane [ctb], Maƫlle Salmon [ctb] |
Maintainer: | Neal Richardson <neal.p.richardson at gmail.com> |
BugReports: | https://github.com/nealrichardson/httptest/issues |
License: | MIT + file LICENSE |
URL: | https://enpiar.com/r/httptest/, https://github.com/nealrichardson/httptest |
NeedsCompilation: | no |
Language: | en-US |
Materials: | README NEWS |
In views: | WebTechnologies |
CRAN checks: | httptest results |
Reference manual: | httptest.pdf |
Vignettes: |
Frequently Asked Questions httptest: A Test Environment for HTTP Requests in R Redacting and Modifying Recorded Requests Writing Vignettes with APIs |
Package source: | httptest_4.2.2.tar.gz |
Windows binaries: | r-devel: httptest_4.2.2.zip, r-release: httptest_4.2.2.zip, r-oldrel: httptest_4.2.2.zip |
macOS binaries: | r-release (arm64): httptest_4.2.2.tgz, r-oldrel (arm64): httptest_4.2.2.tgz, r-release (x86_64): httptest_4.2.2.tgz, r-oldrel (x86_64): httptest_4.2.2.tgz |
Old sources: | httptest archive |
Reverse imports: | crplyr, speechbr |
Reverse suggests: | academictwitteR, aiRly, alfr, bambooHR, bitmexr, briqr, ccdR, cloudos, codewhere, colourlovers, cometr, connectapi, covidcast, crunch, crunchy, ctxR, dkanr, DNH4, echor, edgarWebR, eph, EpiTxDb, ffscrapr, foundry, geofi, gwasrapidd, hackeRnews, httpcache, influxdbclient, koinar, lacrmr, markmyassignment, metabolomicsWorkbenchR, MetMashR, mstrio, nhdplusTools, npi, ohsome, openmeteo, osdatahub, oysteR, pivotaltrackR, pocketapi, portalr, promr, ProPublicaR, pxweb, qtkit, ramlegacy, rnassqs, rnbp, SC2API, scryr, sentryR, spectator, sship, tcpl, tidygeoRSS, tidyRSS, tRNAdbImport, yahoofinancer, zzlite |
Please use the canonical form https://CRAN.R-project.org/package=httptest to link to this page.