Testing code and packages that communicate with remote servers can be painful. Dealing with authentication, bootstrapping server state, cleaning up objects that may get created during the test run, network flakiness, 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 test contexts that mock the network connection in different ways, and it offers additional expectations to assert that HTTP requests were--or were not--made. Using these tools, one can test that code is making the intended requests and that it handles the expected responses correctly, all without depending on a connection to a remote API.

Maintainer: Neal Richardson <neal.p.richardson at gmail.com>

Author(s): Neal Richardson*

Install package and any missing dependencies by running this line in your R console:

install.packages("httptest")

Depends R (>= 3.0.0), testthat
Imports digest, httr, jsonlite
Suggests knitr
Enhances
Linking to
Reverse
depends
Reverse
imports
Reverse
suggests
crplyr, crunch, httpcache, rGoodData
Reverse
enhances
Reverse
linking to

Package httptest
Materials
URL https://github.com/nealrichardson/httptest
Task Views
Version 2.0.0
Published 2017-06-05
License MIT + file LICENSE
BugReports https://github.com/nealrichardson/httptest/issues
SystemRequirements
NeedsCompilation no
Citation
CRAN checks httptest check results
Package source httptest_2.0.0.tar.gz