| Recipe 34 | Play Back Canned Network Data Using VCR |
Problem
You’re testing an app that relies on one or more third-party, HTTP-based APIs. You’re worried about what will happen to your test results if one of the APIs you use times out or starts returning different data than what you expected.
Ingredients
-
VCR,[220] a library that can record a live HTTP interaction and then play it back during testing
-
WebMock[221] for simulating web traffic
Solution
Before we start writing the code for this recipe, let’s talk about application styles. There’s a whole class of apps whose usefulness comes from the way they tie together data sources from around the Web. Consider, for instance, the Influence Explorer civic project from Sunlight Labs.[222] This site ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access