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 ...
Get Cucumber Recipes now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.