ronny
January 24, 2020, 10:13pm
1
Hello!
I have been working on a package that takes an API from a CRM to be able to get the data into R and also create son items in the CRM account from R. I have the functions but one question that comes to my mind is How can I test the functions without having to connect to the API? Is there documentation or examples about this that you can point me out?
Thanks!
4 Likes
Hello @ronny here is a great article from R-Hub that gives a great overview on some best practices:
See also the more recent update.
When writing unit tests for a package, you might find yourself wondering about how to best test the behaviour of your package
when the data it’s supposed to munge has this or that quirk,
when the operating system...
3 Likes
ronny
January 27, 2020, 9:45pm
3
Great! Thanks for the info!
Here are some other resources you might want explore:
I’m by no means an expert in API testing best practices, but I’m (slowly) learning the ropes. Some resources that might be beneficial to others: httr package vignette, Best practices for API packages Gabor’s secret package Recent useR...
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....
Stubbing and setting expectations on HTTP requests.
Includes tools for stubbing HTTP requests, including expected
request conditions and response conditions. Match on
HTTP method, query parameters, request body, headers and
more. Can...
Record test suite HTTP requests and replays them during
future runs. A port of the Ruby gem of the same name
(). Works by hooking into the webmockr
R package for matching HTTP requests by various rules (HTTP method,
URL, query...
4 Likes
system
Closed
February 3, 2020, 11:52pm
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.